From f6d86fae72cfd2be6395b2d12fbe7952147439f6 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Thu, 28 Jul 2022 10:34:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=89=E7=8E=8B=E5=8A=A8=E6=80=81=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/image_process.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/hgdriver/hgdev/image_process.cpp b/hgdriver/hgdev/image_process.cpp index fd5bee7..b3faff7 100644 --- a/hgdriver/hgdev/image_process.cpp +++ b/hgdriver/hgdev/image_process.cpp @@ -624,7 +624,7 @@ namespace hg_imgproc #endif return ret; } - //除网? + //除网�? int textureRemove() { int ret = SCANNER_ERR_OK; @@ -714,7 +714,7 @@ namespace hg_imgproc } return ret; } - //答题卡出? + //答题卡出�? int answerSheetFilterRed() { int ret = SCANNER_ERR_OK; @@ -767,6 +767,7 @@ namespace hg_imgproc int ret = SCANNER_ERR_OK; void *pHanld = NULL; #ifndef x86_64 //linux x86_64 暂时没有OCR三方 +#ifndef test std::vector mats(mats_); mats_.clear(); @@ -789,10 +790,33 @@ namespace hg_imgproc mats_.push_back(mats[i]); } HWOCR_SDKExit(pHanld); + +#else + typedef int (*sdkinit)(void *); + typedef int (*sdkgetfiledirectimage)(unsigned char*pbImage, int nWidth, int nHeight, TColorType nColorType, void *pstHandle, int *pDirect); + typedef int (*sdkexit)(void *); + void *hanlde = dlopen("libhwocrdetect.so",RTLD_LAZY); + if(!hanlde) + { + printf("000000\r\n"); + return -1; + } + sdkinit init = (sdkinit)dlsym(hanlde , "HWOCR_SDKInitialize"); + sdkgetfiledirectimage d = (sdkgetfiledirectimage)dlsym(hanlde , "HWOCR_GetFileDirectImage"); + sdkexit e= (sdkexit)dlsym(hanlde , "HWOCR_SDKExit"); + if (init && d && e) + { + ret = init(pHanld); + for (size_t i = 0; i < mats.size(); i++) + { + ret = d(const_cast(mats[i].data),mats[i].cols,mats[i].rows,mats[i].channels()== 1 ? TColorType::EGray256:TColorType::EColor16M,pHanld,&pDirect); + } + } + e(pHanld) ; +#endif #endif return ret; - } - + } int size_detection() { int ret = SCANNER_ERR_OK;