From eda1a611bc4afcf1c36a6c728f432aec1f688e1b Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 27 六月 2022 19:13:36 +0800 Subject: [PATCH] 'GP代码识别' --- ConsoleApplication/OpenclTest.cpp | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ConsoleApplication/OpenclTest.cpp b/ConsoleApplication/OpenclTest.cpp index 16337f6..673c0b4 100644 --- a/ConsoleApplication/OpenclTest.cpp +++ b/ConsoleApplication/OpenclTest.cpp @@ -11,7 +11,7 @@ uchar* createTemplateData(int line); int LINE_NUMBER = 10; -int RE = 17; +int RE = _NUMBER_L2_TOTAL_NUMBER; @@ -253,7 +253,7 @@ op->init(); for (int i = 0;i < 100;i++) { - op->recognition_numbers(a_in, b_in, rows, cols); + op->recognition_numbers(a_in, b_in, rows, cols ,_NUMBER_L2_WIDTH, _NUMBER_L2_HEIGHT, _NUMBER_L2_TOTAL_NUMBER); } op->destory(); @@ -261,7 +261,7 @@ } uchar* createDemoData(int line) { - unsigned char* data = (unsigned char*)malloc(sizeof(unsigned char) * (ImgUtil::NUM_HEIGHT * line) * 5 * LINE_NUMBER * RE); + unsigned char* data = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_L2_HEIGHT * line) * 5 * LINE_NUMBER * RE); int outLineDataCount = 8 * 5 * LINE_NUMBER * RE; int inLineDataCount = 5 * LINE_NUMBER * RE; for (int l = 0;l < line;l++) @@ -277,7 +277,7 @@ int intLineCount = inLineDataCount * r; for (int c = 0;c < 5;c++) { - uchar value = ImgUtil::NUMS[re%10].data.ptr(r)[c]; + uchar value = ImgUtil::NUMS_LEVEL2[re%10].data.ptr(r)[c]; int index = outLineCount; index += intLineCount; int x = re * LINE_NUMBER * 5 + n * 5 + c; @@ -292,23 +292,23 @@ } uchar* createTemplateData(int line) { - unsigned char* data = (unsigned char*)malloc(sizeof(unsigned char) * (ImgUtil::NUM_HEIGHT * line) * ImgUtil::NUM_WIDTH * LINE_NUMBER * RE); - int outLineDataCount = ImgUtil::NUM_HEIGHT * ImgUtil::NUM_WIDTH * LINE_NUMBER * RE; - int inLineDataCount = ImgUtil::NUM_WIDTH * LINE_NUMBER * RE; + unsigned char* data = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_L2_HEIGHT * line) * _NUMBER_L2_WIDTH * LINE_NUMBER * RE); + int outLineDataCount = _NUMBER_L2_HEIGHT * _NUMBER_L2_WIDTH * LINE_NUMBER * RE; + int inLineDataCount = _NUMBER_L2_WIDTH * LINE_NUMBER * RE; for (int l = 0;l < line;l++) { int outLineCount = outLineDataCount * l; for (int re = 0;re < RE;re++) { for (int n = 0;n < LINE_NUMBER;n++) { - for (int r = 0;r < ImgUtil::NUM_HEIGHT;r++) { + for (int r = 0;r < _NUMBER_L2_HEIGHT;r++) { int intLineCount = inLineDataCount * r; - for (int c = 0;c < ImgUtil::NUM_WIDTH;c++) { - uchar value = ImgUtil::NUMS[n].data.ptr(r)[c]; + for (int c = 0;c < _NUMBER_L2_WIDTH;c++) { + uchar value = ImgUtil::NUMS_LEVEL2[n].data.ptr(r)[c]; int index = outLineCount; index += intLineCount; - int x = re * LINE_NUMBER * ImgUtil::NUM_WIDTH + n * ImgUtil::NUM_WIDTH + c; + int x = re * LINE_NUMBER * _NUMBER_L2_WIDTH + n * _NUMBER_L2_WIDTH + c; index += x; data[index] = value > 40 ? 1 : 0; } -- Gitblit v1.8.0