Add CPU/GPU gate and support new ANSALPR using OCR

This commit is contained in:
2026-04-12 17:16:16 +10:00
parent 27083a6530
commit 0a8aaed215
30 changed files with 1870 additions and 2166 deletions

View File

@@ -4,6 +4,7 @@
#include "ANSLPR.h"
#include "ANSLPR_CPU.h"
#include "ANSLPR_OD.h"
#include "ANSLPR_OCR.h"
#include "ANSLibsLoader.h"
#include "ANSGpuFrameRegistry.h" // gpu_frame_lookup(cv::Mat*)
#include <unordered_set>
@@ -141,6 +142,9 @@ static int CreateANSALPRHandle_Impl(ANSCENTER::ANSALPR** Handle, const char* lic
else if (engineType == 1) {
(*Handle) = new ANSCENTER::ANSALPR_OD();
}
else if (engineType == 2) {
(*Handle) = new ANSCENTER::ANSALPR_OCR();// ONNX OCR (PaddleOCR v5)
}
else {
return 0;
}
@@ -757,6 +761,17 @@ extern "C" ANSLPR_API int ANSALPR_SetALPRCheckerEnabled(ANSCENTER::ANSALPR**
}
}
extern "C" ANSLPR_API int ANSALPR_SetCountry(ANSCENTER::ANSALPR** Handle, int country) {
if (!Handle || !*Handle) return -1;
try {
(*Handle)->SetCountry(static_cast<ANSCENTER::Country>(country));
return 1;
}
catch (...) {
return 0;
}
}
extern "C" ANSLPR_API int ANSALPR_GetFormats(ANSCENTER::ANSALPR** Handle, LStrHandle Lstrformats)// semi separated formats
{
if (!Handle || !*Handle) return -1;