Fix ALPR Batch and memory leak

This commit is contained in:
2026-04-15 23:00:19 +10:00
parent b05c49ad93
commit 808df4656d
8 changed files with 1846 additions and 54 deletions

View File

@@ -17,6 +17,7 @@
using namespace ANSCENTER;
using namespace cv;
using namespace std;
cv::Mat JpegStringToMat(const std::string& jpegStr) {
if (jpegStr.length() > 10) {
try {
@@ -1366,8 +1367,8 @@ int TestGetImage() {
}
int GenerateVideo() {
std::string imageFolder = "E:\\Programs\\DemoAssets\\ImageSeries\\20260413_152604.321";
std::string outputVideoPath = "E:\\Programs\\DemoAssets\\ImageSeries\\output3.mp4";
std::string imageFolder = "E:\\Programs\\DemoAssets\\ImageSeries\\20260415_142435.655";
std::string outputVideoPath = "E:\\Programs\\DemoAssets\\ImageSeries\\output7.mp4";
int conversionResult = ANSCV_ImagesToMP4_S(imageFolder.c_str(), outputVideoPath.c_str(), 0,20);
if (!conversionResult) {
std::cerr << "Failed to convert images to MP4." << std::endl;
@@ -1418,6 +1419,13 @@ int OpenCVFunctionTest() {
int main()
{
ANSCENTER::ANSOPENCV::InitCameraNetwork();
// Print the FFmpeg library license strings. The FFmpeg symbols are
// resolved inside ANSCV.dll (which is linked against libavcodec etc.),
// so this works without the unit test having to link FFmpeg itself.
//ANSCV_PrintFFmpegLicense_S();
//OpenCVFunctionTest();
GenerateVideo();
//VideoTestClient();

View File

@@ -3656,7 +3656,7 @@ int ALPR_OCR_Test() {
ANSCENTER::ANSALPR* infHandle = nullptr;
std::string licenseKey = "";
std::string modelFilePath = "C:\\Projects\\ANSVIS\\Models\\ANS_GenericALPR_v2.0.zip";
std::string imagePath = "C:\\Programs\\ModelTraining\\JLPD\\data\\test3.jpg";
std::string imagePath = "C:\\Programs\\ModelTraining\\JLPD\\data\\test6.jpg";
int engineType = 2; // ANSALPR_OCR
double detectionThreshold = 0.3;
@@ -3830,7 +3830,7 @@ int ALPR_OCR_VideoTest() {
}
// Step 2: Set country (JAPAN = 5 — adjust to match the dataset if needed)
ANSALPR_SetCountry(&infHandle, 5);
ANSALPR_SetCountry(&infHandle, 1);
std::cout << "Country set to JAPAN" << std::endl;
// Step 3: Load engine