汉王动态加载

This commit is contained in:
13038267101 2022-07-28 10:34:48 +08:00
parent d48220919d
commit f6d86fae72
1 changed files with 28 additions and 4 deletions

View File

@ -624,7 +624,7 @@ namespace hg_imgproc
#endif #endif
return ret; return ret;
} }
//И≥╓Г╫▒О©? //除网<EFBFBD>?
int textureRemove() int textureRemove()
{ {
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;
@ -714,7 +714,7 @@ namespace hg_imgproc
} }
return ret; return ret;
} }
//Г╜■И╒≤Е█║Е┤╨О©? //答题卡出<EFBFBD>?
int answerSheetFilterRed() int answerSheetFilterRed()
{ {
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;
@ -767,6 +767,7 @@ namespace hg_imgproc
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;
void *pHanld = NULL; void *pHanld = NULL;
#ifndef x86_64 //linux x86_64 暂时没有OCR三方 #ifndef x86_64 //linux x86_64 暂时没有OCR三方
#ifndef test
std::vector<cv::Mat> mats(mats_); std::vector<cv::Mat> mats(mats_);
mats_.clear(); mats_.clear();
@ -789,10 +790,33 @@ namespace hg_imgproc
mats_.push_back(mats[i]); mats_.push_back(mats[i]);
} }
HWOCR_SDKExit(pHanld); 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<uchar*>(mats[i].data),mats[i].cols,mats[i].rows,mats[i].channels()== 1 ? TColorType::EGray256:TColorType::EColor16M,pHanld,&pDirect);
}
}
e(pHanld) ;
#endif
#endif #endif
return ret; return ret;
} }
int size_detection() int size_detection()
{ {
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;