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;