Unify country and ocr mode on both ANSOCR and ANSALPR

This commit is contained in:
2026-03-30 15:21:32 +11:00
parent 08fb2e9adf
commit dd2009d87a
8 changed files with 55 additions and 53 deletions

View File

@@ -19,15 +19,6 @@ namespace ANSCENTER {
OCR_ALPR = 1
};
enum ALPRCountry {
ALPR_JAPAN = 0,
ALPR_VIETNAM = 1,
ALPR_CHINA = 2,
ALPR_USA = 3,
ALPR_AUSTRALIA = 4,
ALPR_CUSTOM = 99
};
enum ALPRCharClass {
CHAR_DIGIT = 0,
CHAR_LATIN_ALPHA = 1,
@@ -53,7 +44,7 @@ namespace ANSCENTER {
struct ALPRPlateFormat {
std::string name;
ALPRCountry country = ALPR_JAPAN;
Country country = JAPAN;
int numRows = 2;
std::vector<ALPRZone> zones;
float rowSplitThreshold = 0.3f;
@@ -152,7 +143,7 @@ namespace ANSCENTER {
// ALPR settings
OCRMode _ocrMode = OCR_GENERAL;
ALPRCountry _alprCountry = ALPR_JAPAN;
Country _alprCountry = JAPAN;
std::vector<ALPRPlateFormat> _alprFormats;
void CheckLicense();
@@ -171,12 +162,12 @@ namespace ANSCENTER {
// ALPR configuration methods
void SetOCRMode(OCRMode mode);
OCRMode GetOCRMode() const;
void SetALPRCountry(ALPRCountry country);
ALPRCountry GetALPRCountry() const;
void SetCountry(Country country);
Country GetCountry() const;
void SetALPRFormat(const ALPRPlateFormat& format);
void AddALPRFormat(const ALPRPlateFormat& format);
void ClearALPRFormats();
void LoadDefaultFormats(ALPRCountry country);
void LoadDefaultFormats(Country country);
const std::vector<ALPRPlateFormat>& GetALPRFormats() const;
~ANSOCRBase() {
@@ -249,7 +240,7 @@ extern "C" ANSOCR_API int RunInferencesComplete_LV(ANSCENTER::ANSOCRBase** H
// ALPR configuration API
extern "C" ANSOCR_API int SetANSOCRMode(ANSCENTER::ANSOCRBase** Handle, int ocrMode);
extern "C" ANSOCR_API int SetANSOCRALPRCountry(ANSCENTER::ANSOCRBase** Handle, int country);
extern "C" ANSOCR_API int SetANSOCRCountry(ANSCENTER::ANSOCRBase** Handle, int country);
extern "C" ANSOCR_API int SetANSOCRALPRFormat(ANSCENTER::ANSOCRBase** Handle, const char* formatJson);
// V2 Create / Release — handle as uint64_t by value (no pointer-to-pointer)