mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 19:12:47 +08:00
Added windows DLL export to C lib
This commit is contained in:
@@ -12,7 +12,7 @@ set(alprc_source
|
|||||||
|
|
||||||
add_library(openalprc SHARED ${alprc_source})
|
add_library(openalprc SHARED ${alprc_source})
|
||||||
|
|
||||||
set_target_properties(openalprc PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
|
#set_target_properties(openalprc PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(openalprc openalpr)
|
TARGET_LINK_LIBRARIES(openalprc openalpr)
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir)
|
OPENALPRC_DLL_EXPORT OPENALPR* openalpr_init(const char* country, const char* configFile, const char* runtimeDir)
|
||||||
{
|
{
|
||||||
alpr::Alpr* alpr_inst = new alpr::Alpr(country, configFile, runtimeDir);
|
alpr::Alpr* alpr_inst = new alpr::Alpr(country, configFile, runtimeDir);
|
||||||
|
|
||||||
@@ -30,35 +30,35 @@ OPENALPR* openalpr_init(const char* country, const char* configFile, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the country used for plate recognition
|
// Set the country used for plate recognition
|
||||||
void openalpr_set_country(OPENALPR* instance, const char* country)
|
OPENALPRC_DLL_EXPORT void openalpr_set_country(OPENALPR* instance, const char* country)
|
||||||
{
|
{
|
||||||
((alpr::Alpr*) instance)->setCountry(country);
|
((alpr::Alpr*) instance)->setCountry(country);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the prewarp setting without reloading the library
|
// Update the prewarp setting without reloading the library
|
||||||
void openalpr_set_prewarp(OPENALPR* instance, const char* prewarp_config)
|
OPENALPRC_DLL_EXPORT void openalpr_set_prewarp(OPENALPR* instance, const char* prewarp_config)
|
||||||
{
|
{
|
||||||
((alpr::Alpr*) instance)->setPrewarp(prewarp_config);
|
((alpr::Alpr*) instance)->setPrewarp(prewarp_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the detection mask without reloading the library
|
// Update the detection mask without reloading the library
|
||||||
void openalpr_set_mask(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight)
|
OPENALPRC_DLL_EXPORT void openalpr_set_mask(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight)
|
||||||
{
|
{
|
||||||
((alpr::Alpr*) instance)->setMask(pixelData, bytesPerPixel, imgWidth, imgHeight);
|
((alpr::Alpr*) instance)->setMask(pixelData, bytesPerPixel, imgWidth, imgHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable/disable region detection. Pass a 0 or 1
|
// Enable/disable region detection. Pass a 0 or 1
|
||||||
void openalpr_set_detect_region(OPENALPR* instance, int detectRegion)
|
OPENALPRC_DLL_EXPORT void openalpr_set_detect_region(OPENALPR* instance, int detectRegion)
|
||||||
{
|
{
|
||||||
((alpr::Alpr*) instance)->setDetectRegion(detectRegion);
|
((alpr::Alpr*) instance)->setDetectRegion(detectRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openalpr_set_topn(OPENALPR* instance, int topN)
|
OPENALPRC_DLL_EXPORT void openalpr_set_topn(OPENALPR* instance, int topN)
|
||||||
{
|
{
|
||||||
((alpr::Alpr*) instance)->setTopN(topN);
|
((alpr::Alpr*) instance)->setTopN(topN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openalpr_set_default_region(OPENALPR* instance, const char* region)
|
OPENALPRC_DLL_EXPORT void openalpr_set_default_region(OPENALPR* instance, const char* region)
|
||||||
{
|
{
|
||||||
((alpr::Alpr*) instance)->setDefaultRegion(region);
|
((alpr::Alpr*) instance)->setDefaultRegion(region);
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ void openalpr_set_default_region(OPENALPR* instance, const char* region)
|
|||||||
|
|
||||||
// Recognizes the provided image and responds with JSON.
|
// Recognizes the provided image and responds with JSON.
|
||||||
// Caller must call free() on the returned object
|
// Caller must call free() on the returned object
|
||||||
char* openalpr_recognize_rawimage(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, AlprCRegionOfInterest roi)
|
OPENALPRC_DLL_EXPORT char* openalpr_recognize_rawimage(OPENALPR* instance, unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, AlprCRegionOfInterest roi)
|
||||||
{
|
{
|
||||||
std::vector<alpr::AlprRegionOfInterest> rois;
|
std::vector<alpr::AlprRegionOfInterest> rois;
|
||||||
alpr::AlprRegionOfInterest cpproi(roi.x, roi.y, roi.width, roi.height);
|
alpr::AlprRegionOfInterest cpproi(roi.x, roi.y, roi.width, roi.height);
|
||||||
@@ -82,7 +82,7 @@ char* openalpr_recognize_rawimage(OPENALPR* instance, unsigned char* pixelData,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* openalpr_recognize_encodedimage(OPENALPR* instance, unsigned char* bytes, long long length, AlprCRegionOfInterest roi)
|
OPENALPRC_DLL_EXPORT char* openalpr_recognize_encodedimage(OPENALPR* instance, unsigned char* bytes, long long length, AlprCRegionOfInterest roi)
|
||||||
{
|
{
|
||||||
std::vector<alpr::AlprRegionOfInterest> rois;
|
std::vector<alpr::AlprRegionOfInterest> rois;
|
||||||
alpr::AlprRegionOfInterest cpproi(roi.x, roi.y, roi.width, roi.height);
|
alpr::AlprRegionOfInterest cpproi(roi.x, roi.y, roi.width, roi.height);
|
||||||
@@ -99,7 +99,7 @@ char* openalpr_recognize_encodedimage(OPENALPR* instance, unsigned char* bytes,
|
|||||||
return result_obj;
|
return result_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void openalpr_cleanup(OPENALPR* instance)
|
OPENALPRC_DLL_EXPORT void openalpr_cleanup(OPENALPR* instance)
|
||||||
{
|
{
|
||||||
delete ((alpr::Alpr*) instance);
|
delete ((alpr::Alpr*) instance);
|
||||||
}
|
}
|
@@ -25,6 +25,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define OPENALPRC_DLL_EXPORT __declspec( dllexport )
|
||||||
|
#else
|
||||||
|
#define OPENALPRC_DLL_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void OPENALPR;
|
typedef void OPENALPR;
|
||||||
|
|
||||||
struct AlprCRegionOfInterest
|
struct AlprCRegionOfInterest
|
||||||
|
Reference in New Issue
Block a user