扫描至OCR暂时使用内置OCR,不使用HGOCR进程
This commit is contained in:
parent
209d01a486
commit
26c59eb32d
|
@ -3652,6 +3652,7 @@ void MainWindow::ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg *msg, HGPointer p
|
|||
{
|
||||
QString *filePath = (QString *)msg->data;
|
||||
|
||||
#if 0
|
||||
HGChar moduleName[256];
|
||||
HGBase_GetModuleName(nullptr, moduleName, 256);
|
||||
HGChar curPath2[256];
|
||||
|
@ -3700,6 +3701,38 @@ void MainWindow::ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg *msg, HGPointer p
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
HGOCRMgr ocrMgr = NULL;
|
||||
HGImgProc_CreateOCRMgr(HGIMGPROC_OCRALGO_DEFAULT, &ocrMgr);
|
||||
if (NULL != ocrMgr)
|
||||
{
|
||||
HGImgFmtReader reader = NULL;
|
||||
HGImgFmt_OpenImageReader(filePath->toLocal8Bit().toStdString().c_str(), 0, &reader);
|
||||
if (NULL != reader)
|
||||
{
|
||||
HGUInt count = 0;
|
||||
HGImgFmt_GetImagePageCount(reader, &count);
|
||||
for (HGUInt i = 0; i < count; ++i)
|
||||
{
|
||||
HGImage image = NULL;
|
||||
HGImgFmt_LoadImageFromReader(reader, i, NULL, 0, 0, &image);
|
||||
if (NULL != image)
|
||||
{
|
||||
HGImgProc_AddToImageOCRList(ocrMgr, image);
|
||||
HGBase_DestroyImage(image);
|
||||
}
|
||||
}
|
||||
|
||||
HGImgFmt_CloseImageReader(reader);
|
||||
}
|
||||
|
||||
HGBase_DeleteFile(filePath->toLocal8Bit().toStdString().c_str());
|
||||
HGImgProc_ImageListOCRToFile(ocrMgr, 0, filePath->toLocal8Bit().toStdString().c_str(), NULL, NULL);
|
||||
|
||||
HGImgProc_DestroyOCRMgr(ocrMgr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
delete filePath;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue