diff --git a/base/HGInc.h b/base/HGInc.h index 2c96e985..b94ebb9a 100644 --- a/base/HGInc.h +++ b/base/HGInc.h @@ -29,6 +29,7 @@ #include #include #include +#include #endif #endif /* __HGINC_H__ */ diff --git a/build/linux/HGImgProc/HGImgProc.cbp b/build/linux/HGImgProc/HGImgProc.cbp index 9dddca29..35eb138b 100644 --- a/build/linux/HGImgProc/HGImgProc.cbp +++ b/build/linux/HGImgProc/HGImgProc.cbp @@ -16,6 +16,7 @@ + @@ -26,6 +27,7 @@ + @@ -38,6 +40,7 @@ + @@ -48,7 +51,7 @@ - + @@ -61,6 +64,7 @@ + @@ -71,6 +75,7 @@ + @@ -83,6 +88,7 @@ + @@ -93,7 +99,7 @@ - + @@ -106,6 +112,7 @@ + @@ -115,6 +122,7 @@ + @@ -127,6 +135,7 @@ + @@ -136,7 +145,7 @@ - + @@ -155,6 +164,14 @@ + + + + + + + + diff --git a/build/linux/HGTest/main.cpp b/build/linux/HGTest/main.cpp index 30e3bfca..83313bc1 100644 --- a/build/linux/HGTest/main.cpp +++ b/build/linux/HGTest/main.cpp @@ -2,31 +2,9 @@ #include "../../../base/HGBase.h" #include "../../../imgfmt/HGImgFmt.h" #include "../../../imgproc/HGImgProc.h" +#include "../../../imgproc/HGOCR.h" int main() { - HGImage img = NULL; - - HGImgFmt_LoadImage("1.pdf", 0, NULL, HGBASE_IMGTYPE_RGB, HGBASE_IMGORIGIN_TOP, &img); - HGImgFmt_SaveImage(img, 0, NULL, 0, "pdf2pdf.pdf"); - HGBase_DestroyImage(img); - - HGImgFmt_LoadImage("1.jpg", 0, NULL, HGBASE_IMGTYPE_RGB, HGBASE_IMGORIGIN_TOP, &img); - HGImgFmt_SaveImage(img, 0, NULL, 0, "jpg2pdf.pdf"); - HGBase_DestroyImage(img); - - HGImgFmt_LoadImage("1.pdf", 0, NULL, HGBASE_IMGTYPE_RGB, HGBASE_IMGORIGIN_TOP, &img); - HGImgFmt_SaveImage(img, 0, NULL, 0, "pdf2jpg.jpg"); - HGBase_DestroyImage(img); - - HGImgFmt_LoadImage("1.bmp", 0, NULL, HGBASE_IMGTYPE_RGB, HGBASE_IMGORIGIN_BOTTOM, &img); - HGImage imgCrop = NULL; - HGImgProc_ImageDeskew(img, HGFALSE, HGFALSE, NULL, 800, 1200, HGBASE_IMGTYPE_BGRA, HGBASE_IMGORIGIN_TOP, &imgCrop); - HGImgFmt_SaveImage(imgCrop, 0, NULL, 0, "deskew.bmp"); - HGBase_DestroyImage(imgCrop); - HGBase_DestroyImage(img); - - HGBase_WriteInfo(HGBASE_INFOTYPE_DEBUG, "%d", 123456); - HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "%d", 12345); return 0; } diff --git a/build/linux/HGWebService/HGWebService.cbp b/build/linux/HGWebService/HGWebService.cbp index f7b0f200..7ebd3e35 100644 --- a/build/linux/HGWebService/HGWebService.cbp +++ b/build/linux/HGWebService/HGWebService.cbp @@ -14,6 +14,7 @@ + @@ -25,6 +26,7 @@ + @@ -35,6 +37,7 @@ + @@ -47,6 +50,7 @@ + @@ -57,6 +61,7 @@ + @@ -68,6 +73,7 @@ + @@ -78,6 +84,7 @@ + @@ -90,6 +97,7 @@ + @@ -100,6 +108,7 @@ + @@ -111,6 +120,7 @@ + @@ -121,6 +131,7 @@ + @@ -133,6 +144,7 @@ + @@ -144,6 +156,9 @@ + + + diff --git a/build/linux/default.workspace b/build/linux/default.workspace index 073e5dda..ddd6dc80 100644 --- a/build/linux/default.workspace +++ b/build/linux/default.workspace @@ -7,6 +7,7 @@ + diff --git a/imgfmt/HGOfdImpl.cpp b/imgfmt/HGOfdImpl.cpp index baf95b4d..29b13ce7 100644 --- a/imgfmt/HGOfdImpl.cpp +++ b/imgfmt/HGOfdImpl.cpp @@ -578,7 +578,7 @@ bool HGOfdImageWriterImpl::AddDocXml() tinyxml2::XMLElement* physicalBox = xmlDoc.NewElement("ofd:PhysicalBox"); char physicalBoxText[512]; - sprintf(physicalBoxText, "0.000000 0.000000 %f %f", A4page_page_PhysicalBox_Width, + sprintf(physicalBoxText, "0.000000 0.000000 %f %f", A4page_page_PhysicalBox_Width, A4page_page_PhysicalBox_Height); physicalBox->SetText(physicalBoxText); pageArea->InsertEndChild(physicalBox); @@ -752,7 +752,7 @@ bool HGOfdImageWriterImpl::AddContentXmlFile(HGUInt index, HGFloat physicalWidth imgObject->SetAttribute("CTM", ctmText); layer->InsertEndChild(imgObject); - HGChar name[128]; + HGChar name[256]; sprintf(name, "%s/Content.xml", dir); return AddXmlFile(xmlDoc, name); } diff --git a/imgproc/HGOCRHanvon.cpp b/imgproc/HGOCRHanvon.cpp index 23e28fce..99b9b792 100644 --- a/imgproc/HGOCRHanvon.cpp +++ b/imgproc/HGOCRHanvon.cpp @@ -38,7 +38,7 @@ HGResult HGOCRHanvon::Init() #if defined(HG_CMP_MSC) HGResult ret = HGBase_CreateDll("hanwangOCRdetect.dll", &m_dll); #else - HGResult ret = HGBase_CreateDll("hanwangOCRdetect.so", &m_dll); + HGResult ret = HGBase_CreateDll("libhwocrdetect.so", &m_dll); #endif HGBase_SetCurrentDir(oldDir); if (HGBASE_ERR_OK != ret) @@ -288,4 +288,4 @@ int HGOCRHanvon::HWOCR_GetFileDirect(unsigned char* ImgFile, void* pstHandle, in } return func(ImgFile, pstHandle, pDirect); -} \ No newline at end of file +} diff --git a/sdk/webservice/Manager.cpp b/sdk/webservice/Manager.cpp index 79344517..ebc29c9a 100644 --- a/sdk/webservice/Manager.cpp +++ b/sdk/webservice/Manager.cpp @@ -1355,8 +1355,8 @@ bool Manager::GetImageBase64(const std::string& devId, const std::string& imgNam std::string Manager::GetFilePath(const std::string& devId) { - HGChar docsPath[512]; - HGBase_GetDocumentsPath(docsPath, 512); + HGChar docsPath[256]; + HGBase_GetDocumentsPath(docsPath, 256); HGChar imgPath[512]; sprintf(imgPath, "%sHuago/WebService/%s/", docsPath, Utf8ToStdString(devId.c_str()).c_str()); HGChar stdImgPath[512]; @@ -1547,7 +1547,7 @@ bool Manager::SaveBase64(const std::string& fileName, const char* base64) HGBase_Base64Decode((const HGByte*)base64, (HGSize)base64Size, data, &size); size_t writeLen = fwrite(data, 1, size, file); - if (writeLen == size) + if (writeLen == (size_t)size) ret = true; delete[] data; @@ -1560,7 +1560,7 @@ bool Manager::SaveBase64(const std::string& fileName, const char* base64) static std::string MakePreFileData(const char* pszBoundary, const char* pszRemoteFileName) { char data[512]; - sprintf(data, "--%s\r\nContent-Disposition: form-data; name=\"filedata\"; filename=\"%s\"\r\n", + sprintf(data, "--%s\r\nContent-Disposition: form-data; name=\"filedata\"; filename=\"%s\"\r\n", pszBoundary, pszRemoteFileName); std::string ret = data; ret += "Content-Type: application/octet-stream; charset=utf-8\r\n"; @@ -1663,8 +1663,12 @@ bool Manager::HTTPUpload(const std::string& localFileName, const std::string& ht assert(-1 != sockClient); #endif +#if defined(HG_CMP_MSC) u_long ul = 1; // 设为非阻塞 ioctlsocket(sockClient, FIONBIO, &ul); +#else + ioctl(sockClient, FIONBIO, 1); +#endif #if defined(HG_CMP_MSC) SOCKADDR_IN addrServer = { 0 }; @@ -1674,7 +1678,7 @@ bool Manager::HTTPUpload(const std::string& localFileName, const std::string& ht if (0 != connect(sockClient, (SOCKADDR*)&addrServer, sizeof(SOCKADDR_IN))) #else struct sockaddr_in addrServer = { 0 }; - addrServer.sin_addr.S_un.S_addr = inet_addr(addr.c_str()); + addrServer.sin_addr.s_addr = inet_addr(addr.c_str()); addrServer.sin_family = AF_INET; addrServer.sin_port = htons(port); if (0 != connect(sockClient, (struct sockaddr*)&addrServer, sizeof(addrServer))) @@ -1710,8 +1714,12 @@ bool Manager::HTTPUpload(const std::string& localFileName, const std::string& ht } } +#if defined(HG_CMP_MSC) ul = 0; // 设为阻塞 ioctlsocket(sockClient, FIONBIO, &ul); +#else + ioctl(sockClient, FIONBIO, 0); +#endif char remoteName[256]; HGBase_GetFileName(localFileName.c_str(), remoteName, 256); @@ -1780,7 +1788,7 @@ static size_t read_callback(char* ptr, size_t size, size_t nmemb, void* stream) return retcode; } -bool Manager::FTPUpload(const std::string& localFileName, const std::string& ftpUrl, int ftpPort, const std::string& ftpPath, +bool Manager::FTPUpload(const std::string& localFileName, const std::string& ftpUrl, int ftpPort, const std::string& ftpPath, const std::string& ftpUser, const std::string& ftpPassword, int ftpMode) { FILE* file = fopen(localFileName.c_str(), "rb"); @@ -1805,9 +1813,9 @@ bool Manager::FTPUpload(const std::string& localFileName, const std::string& ftp char remoteName[256]; HGBase_GetFileName(localFileName.c_str(), remoteName, 256); - char ftp_rnfr[256]; + char ftp_rnfr[512]; sprintf(ftp_rnfr, "RNFR %s", tmpName); - char ftp_rnto[256]; + char ftp_rnto[512]; sprintf(ftp_rnto, "RNTO %s", remoteName); struct curl_slist* headerlist = NULL; diff --git a/third_party/libcurl/uos/amd64/lib/libcurl.a b/third_party/libcurl/uos/amd64/lib/libcurl.a index 88755194..b615daa6 100644 Binary files a/third_party/libcurl/uos/amd64/lib/libcurl.a and b/third_party/libcurl/uos/amd64/lib/libcurl.a differ diff --git a/third_party/libcurl/uos/amd64/lib/libcurl.la b/third_party/libcurl/uos/amd64/lib/libcurl.la old mode 100644 new mode 100755 index 7e9f181a..6508eff9 --- a/third_party/libcurl/uos/amd64/lib/libcurl.la +++ b/third_party/libcurl/uos/amd64/lib/libcurl.la @@ -17,7 +17,7 @@ old_library='libcurl.a' inherited_linker_flags=' -pthread' # Libraries that this one depends upon. -dependency_libs=' -lidn2 -lzstd -lz' +dependency_libs=' -lz' # Names of additional weak libraries provided by this library weak_library_names='' @@ -38,4 +38,4 @@ dlopen='' dlpreopen='' # Directory that this library needs to be installed in: -libdir='/data/home/luoliangyi/hgproject/third_party/libcurl/uos/amd64/curl-7.82.0/release/lib' +libdir='/data/home/luoliangyi/code_app/third_party/libcurl/uos/amd64/curl-7.82.0/release/lib' diff --git a/third_party/libcurl/uos/amd64/lib/pkgconfig/libcurl.pc b/third_party/libcurl/uos/amd64/lib/pkgconfig/libcurl.pc index f779c035..79306cf3 100644 --- a/third_party/libcurl/uos/amd64/lib/pkgconfig/libcurl.pc +++ b/third_party/libcurl/uos/amd64/lib/pkgconfig/libcurl.pc @@ -23,17 +23,17 @@ # This should most probably benefit from getting a "Requires:" field added # dynamically by configure. # -prefix=/data/home/luoliangyi/hgproject/third_party/libcurl/uos/amd64/curl-7.82.0/release +prefix=/data/home/luoliangyi/code_app/third_party/libcurl/uos/amd64/curl-7.82.0/release exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include supported_protocols="DICT FILE FTP GOPHER HTTP IMAP MQTT POP3 RTSP SMTP TELNET TFTP" -supported_features="AsynchDNS IDN IPv6 Largefile UnixSockets alt-svc libz zstd" +supported_features="AsynchDNS IPv6 Largefile UnixSockets alt-svc libz" Name: libcurl URL: https://curl.se/ Description: Library to transfer files with ftp, http, etc. Version: 7.82.0 -Libs: -L${libdir} -lcurl -lidn2 -lzstd -lz -pthread -Libs.private: -lidn2 -lzstd -lz -pthread +Libs: -L${libdir} -lcurl -lz -pthread +Libs.private: -lz -pthread Cflags: -I${includedir} -DCURL_STATICLIB diff --git a/third_party/ocr/hanvon/uos/aarch64/include/hanwangOCRdetect.h b/third_party/ocr/hanvon/uos/aarch64/include/hanwangOCRdetect.h new file mode 100644 index 00000000..800e1f42 --- /dev/null +++ b/third_party/ocr/hanvon/uos/aarch64/include/hanwangOCRdetect.h @@ -0,0 +1,177 @@ +#include "./ocrcommon.h" + +//使用动态库的时候需要将 hwusbdev.key 放到应用程序相同路径 +//文件类型 +#define FILE_PDF 0 //输出精确版面复原的简体PDF文件 +#define FILE_RTF 2 //输出精确版面复原的简体RTF文件 +#define FILE_XLS 5 //输出简体XLS文件 +#define FILE_TXT 100 //输出为文本格式 +#define FILE_PDF_TXT 101 //输出文本加pdf +#define FILE_JSON 200 //输出为json格式 +#define FILE_OFD 300 //输出双层ofd格式 + +#define STATUS_OK 0 +#define STATUS_NO_MEMORY -1 +#define STATUS_INVALID_PARAMETER -2 +#define STATUS_FAILED -3 + +//顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +/************************************** +功能: 初始化 +参数: ppstOcrHandle [I/O] 初始化识别句柄 + +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_SDKInitialize(void **ppstOcrHandle); + +/************************************** +功能:识别jpg/bmp/tiff/png/gif图像文件,输出txt/json/rtf/xls/pdf格式 +参数: ImgFile [I] 输入图像路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。没有传此参数或者传NULL时,必要时会在pLibDir下生成tmp.jpg图像。 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeFile(unsigned char*ImgFile, unsigned char *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir=NULL); + +/************************************** +功能:识别jpg/bmp/tiff/png/gif批量图像文件,输出txt/json/rtf/xls/pdf格式 +参数: ppImageFiles [I] 输入图像路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。没有传此参数或者传NULL时,必要时会在pLibDir下生成jpg图像。 +返回值:正常返回0,否则<0 +****************************************/ + +int HWOCR_RecognizeFileBatch(char ** ppImageFiles, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir = NULL); + + +/************************************** +功能:识别内存图像的指定块,输出txt/json/rtf格式 +参数: pbImage [I] 图像数据 + nWidth [I] 图像宽度 + nHeight [I] 图像高度 + aLayoutInfo [I] 块属性 + nColorType [I] 颜色属性 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeImgBlock(unsigned char*pbImage, int nWidth, int nHeight, TOCRLayoutBlockInfo aLayoutInfo, + TColorType nColorType, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir); + + +/************************************** +功能:识别jpg/bmp/tiff/png/gif图像文件,输出识别结果字符串 +参数: ImgFile [I] 输入图像路径及文件名 + pstHandle [I] 输入句柄,初始化返回的结果 + ppRst [O] 识别结果字符串 + pnLen [O] 字符串长度 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeFile2Str(BYTE*ImgFile, void *pstHandle,char **ppRst,int* pnLen); + + +/************************************** +功能: 释放识别结果 +参数: ppRst [I] 识别结果字符串 + +返回值: 无 +****************************************/ +void HWOCR_FreeStrRst(char **ppRst); + +/************************************** +功能: 判断识别方向 +参数: ImgFile [I] 输入图像路径及文件名 + pstHandle [I] 输入句柄,初始化返回的结果 + pDirect [O] 图像方向 + //顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +返回值: 正常为0,否则<0 +****************************************/ +int HWOCR_GetFileDirect(BYTE*ImgFile, void *pstHandle, int *pDirect); + + +/************************************** +功能: 判断识别方向,支持24bit 8bit 1bit内存图像。 +参数: pbImage [I] 输入内存图像 + nWidth [I] 图像宽度 + nHeight [I] 图像高度 + nColorType [I] 颜色属性 + pstHandle [I] 输入句柄,初始化返回的结果 + pDirect [O] 图像方向 + //顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +返回值: 正常为0,否则<0 +****************************************/ + +int HWOCR_GetFileDirectImage(BYTE*pbImage, int nWidth, int nHeight, TColorType nColorType, void *pstHandle, int *pDirect); + +/************************************** +功能:识别ofd图像文件,输出txt/json/rtf/xls/pdf/ofd格式 +参数: OfdFile [I] 输入文件路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] 传NULL + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。 + 返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeOFD(BYTE*OfdFile, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir); + +/************************************** +功能:识别pdf图像文件,输出txt/json/rtf/xls/pdf/ofd格式 +参数: PdfFile [I] 输入文件路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] 传NULL + pTmpDir [I] 保存临时文件的目录,需要有写权限。 + 返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizePDF(BYTE*PdfFile, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir); + +/********************************* +功能:调用识别pdf函数前,调用此初始化函数 +**********************************/ +void HWOCR_InitPdf(); + +/********************************* +功能:调用识别pdf函数后,调用此退出函数 +**********************************/ +void HWOCR_ExitPdf(); +/************************************** +功能: 释放识别句柄 +参数: pstOcrHandle [I] 初始化时的句柄 + +返回值:正常返回0,否则<0 +****************************************/ +void HWOCR_SDKExit(void *pstOcrHandle); diff --git a/third_party/ocr/hanvon/uos/aarch64/include/ocrcommon.h b/third_party/ocr/hanvon/uos/aarch64/include/ocrcommon.h new file mode 100644 index 00000000..72f3da8a --- /dev/null +++ b/third_party/ocr/hanvon/uos/aarch64/include/ocrcommon.h @@ -0,0 +1,146 @@ +/*-------------------------------------------------------------------------- + Embedded OCR Engine for embedded platform v1.0 +Copyright (c) 2006HanWang Technology Co., Ltd. All Rights Reserved. + + File: ocrcommon.h + + Description: + common file for embedded OCR module. + + Author: Hanwang Embedded OCR Group + History: + Nov.7, 2006 Created + +---------------------------------------------------------------------------*/ +#ifndef OCRCOMMON_H +#define OCRCOMMON_H + +/*--------------------------------------------------------------------------*/ +/* Typedef's */ +/*--------------------------------------------------------------------------*/ +typedef unsigned char BYTE; +typedef int BOOL; +typedef unsigned short WORD; + +//Data type define +/////////////////////////////////////////////////////////////////////////////// +typedef void (*RecogProgress)( int nPercent); +typedef int (*IsCanceled)(); + +typedef void* (*BCRHeapAlloc)( unsigned int lSize ); +typedef void (*BCRHeapFree)( void *memblock ); + +#define MAX_PATH 260 + + +typedef struct _OCRRect //rectangle +{ + int left; + int top; + int right; + int bottom; +} TOCRRECT; + + +enum TLayoutType //layout text type +{ + ETypeHorizontal, // TYPE_HORIZONTAL, + ETypeVertical // TYPE_VERTICAL +}; + +enum TTextType +{ + ETextMultiLine, //multi-text line + ETextSingleLine //sigle text line +}; +enum TImageBackground //brightness for text background +{ + EBackgroundLight, // dark character with light background + EBackgroundDark, //light character with dark background + EBackgroundUnknown // unknown +}; + + +enum TColorType //color type +{ + EGray2 = 0, //black and white image, 1 bit per pixel + EGray256, // gray image, 8 bit per pixel + EColor16M, // color image, 24 bit per pixel +}; + +struct TOCRTextLineInfo // data structure of text line +{ + char *iText; // during layout analyze, this is null + short *psDistance; + TOCRRECT iRect; // + + TOCRRECT *iCharRect; // This is an array which returns the regions of every single character in this line + int iCharCount; // How many characters in this line +}; + +struct TOCRBlockInfo // data structure of layout infomation +{ + + TOCRRECT iRect; // block coordinates + TLayoutType iType; //vertical or horizontal + int iBlockId; // block's ID + +}; + + +struct TOCRTextRgnInfo // data structure of recognition result +{ + TOCRRECT iRect; // block coordinates + TLayoutType iType; //vertical or horizontal + int iBlockId; // block's ID + + TOCRTextLineInfo *iLines; + int iLineCount; // Lines' count in each block +}; + + +struct TOCRLayoutSetting // data structure of layout settings +{ + enum TBrightness // brightness + { + ENormal, // Normal + ELight, // Light + EDark // Dark + }; + + int iSkew; // switch of skew adjustment 1: do skew adjustment; 0: dont do it + TBrightness iBrightness; // switch of brightness adjustment +}; + +struct TOCRRecognizeSetting // data structure of Recognition settings +{ + int iRotate; + void* iCandidate; // for later usage +}; + + +struct TOCRLayoutBlockInfo // COCRLayoutBlockInfo +{ + TOCRRECT iRect; //block coordinates + TLayoutType iLayout; //vertical or horzontal text + TTextType iText; //mulitline or single line + TImageBackground iBackgroundColor;//brightness for text background +}; + + + +struct TRegionInfo +{ + TOCRRECT iRect; + TImageBackground iBackgroundColor; + + enum TRegionType + { + EEmailAddress, + ETelephoneNumber, + EWWWAddress + }; + + TRegionType iType; +}; +#endif diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/hwusbdev.key b/third_party/ocr/hanvon/uos/aarch64/lib/hwusbdev.key new file mode 100755 index 00000000..68551578 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/hwusbdev.key differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libcnocr.so b/third_party/ocr/hanvon/uos/aarch64/lib/libcnocr.so new file mode 100644 index 00000000..b5919cfa Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libcnocr.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libconvert.so b/third_party/ocr/hanvon/uos/aarch64/lib/libconvert.so new file mode 100644 index 00000000..0e42770b Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libconvert.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libdocseg.so b/third_party/ocr/hanvon/uos/aarch64/lib/libdocseg.so new file mode 100644 index 00000000..81bccfc2 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libdocseg.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libexportfile.so b/third_party/ocr/hanvon/uos/aarch64/lib/libexportfile.so new file mode 100644 index 00000000..223e62cf Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libexportfile.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libhwocrdetect.so b/third_party/ocr/hanvon/uos/aarch64/lib/libhwocrdetect.so new file mode 100644 index 00000000..1e3bdee7 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libhwocrdetect.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libhwocrjni.so b/third_party/ocr/hanvon/uos/aarch64/lib/libhwocrjni.so new file mode 100644 index 00000000..47748bbd Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libhwocrjni.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libofd.so b/third_party/ocr/hanvon/uos/aarch64/lib/libofd.so new file mode 100644 index 00000000..56844562 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libofd.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libpdfparse.so b/third_party/ocr/hanvon/uos/aarch64/lib/libpdfparse.so new file mode 100644 index 00000000..c686cbe9 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libpdfparse.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libtinyxml2.so b/third_party/ocr/hanvon/uos/aarch64/lib/libtinyxml2.so new file mode 100644 index 00000000..99e16e91 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libtinyxml2.so differ diff --git a/third_party/ocr/hanvon/uos/aarch64/lib/libzip.so b/third_party/ocr/hanvon/uos/aarch64/lib/libzip.so new file mode 100644 index 00000000..03de0122 Binary files /dev/null and b/third_party/ocr/hanvon/uos/aarch64/lib/libzip.so differ diff --git a/third_party/ocr/hanvon/uos/amd64/include/hanwangOCRdetect.h b/third_party/ocr/hanvon/uos/amd64/include/hanwangOCRdetect.h new file mode 100644 index 00000000..800e1f42 --- /dev/null +++ b/third_party/ocr/hanvon/uos/amd64/include/hanwangOCRdetect.h @@ -0,0 +1,177 @@ +#include "./ocrcommon.h" + +//使用动态库的时候需要将 hwusbdev.key 放到应用程序相同路径 +//文件类型 +#define FILE_PDF 0 //输出精确版面复原的简体PDF文件 +#define FILE_RTF 2 //输出精确版面复原的简体RTF文件 +#define FILE_XLS 5 //输出简体XLS文件 +#define FILE_TXT 100 //输出为文本格式 +#define FILE_PDF_TXT 101 //输出文本加pdf +#define FILE_JSON 200 //输出为json格式 +#define FILE_OFD 300 //输出双层ofd格式 + +#define STATUS_OK 0 +#define STATUS_NO_MEMORY -1 +#define STATUS_INVALID_PARAMETER -2 +#define STATUS_FAILED -3 + +//顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +/************************************** +功能: 初始化 +参数: ppstOcrHandle [I/O] 初始化识别句柄 + +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_SDKInitialize(void **ppstOcrHandle); + +/************************************** +功能:识别jpg/bmp/tiff/png/gif图像文件,输出txt/json/rtf/xls/pdf格式 +参数: ImgFile [I] 输入图像路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。没有传此参数或者传NULL时,必要时会在pLibDir下生成tmp.jpg图像。 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeFile(unsigned char*ImgFile, unsigned char *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir=NULL); + +/************************************** +功能:识别jpg/bmp/tiff/png/gif批量图像文件,输出txt/json/rtf/xls/pdf格式 +参数: ppImageFiles [I] 输入图像路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。没有传此参数或者传NULL时,必要时会在pLibDir下生成jpg图像。 +返回值:正常返回0,否则<0 +****************************************/ + +int HWOCR_RecognizeFileBatch(char ** ppImageFiles, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir = NULL); + + +/************************************** +功能:识别内存图像的指定块,输出txt/json/rtf格式 +参数: pbImage [I] 图像数据 + nWidth [I] 图像宽度 + nHeight [I] 图像高度 + aLayoutInfo [I] 块属性 + nColorType [I] 颜色属性 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeImgBlock(unsigned char*pbImage, int nWidth, int nHeight, TOCRLayoutBlockInfo aLayoutInfo, + TColorType nColorType, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir); + + +/************************************** +功能:识别jpg/bmp/tiff/png/gif图像文件,输出识别结果字符串 +参数: ImgFile [I] 输入图像路径及文件名 + pstHandle [I] 输入句柄,初始化返回的结果 + ppRst [O] 识别结果字符串 + pnLen [O] 字符串长度 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeFile2Str(BYTE*ImgFile, void *pstHandle,char **ppRst,int* pnLen); + + +/************************************** +功能: 释放识别结果 +参数: ppRst [I] 识别结果字符串 + +返回值: 无 +****************************************/ +void HWOCR_FreeStrRst(char **ppRst); + +/************************************** +功能: 判断识别方向 +参数: ImgFile [I] 输入图像路径及文件名 + pstHandle [I] 输入句柄,初始化返回的结果 + pDirect [O] 图像方向 + //顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +返回值: 正常为0,否则<0 +****************************************/ +int HWOCR_GetFileDirect(BYTE*ImgFile, void *pstHandle, int *pDirect); + + +/************************************** +功能: 判断识别方向,支持24bit 8bit 1bit内存图像。 +参数: pbImage [I] 输入内存图像 + nWidth [I] 图像宽度 + nHeight [I] 图像高度 + nColorType [I] 颜色属性 + pstHandle [I] 输入句柄,初始化返回的结果 + pDirect [O] 图像方向 + //顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +返回值: 正常为0,否则<0 +****************************************/ + +int HWOCR_GetFileDirectImage(BYTE*pbImage, int nWidth, int nHeight, TColorType nColorType, void *pstHandle, int *pDirect); + +/************************************** +功能:识别ofd图像文件,输出txt/json/rtf/xls/pdf/ofd格式 +参数: OfdFile [I] 输入文件路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] 传NULL + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。 + 返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeOFD(BYTE*OfdFile, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir); + +/************************************** +功能:识别pdf图像文件,输出txt/json/rtf/xls/pdf/ofd格式 +参数: PdfFile [I] 输入文件路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] 传NULL + pTmpDir [I] 保存临时文件的目录,需要有写权限。 + 返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizePDF(BYTE*PdfFile, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir); + +/********************************* +功能:调用识别pdf函数前,调用此初始化函数 +**********************************/ +void HWOCR_InitPdf(); + +/********************************* +功能:调用识别pdf函数后,调用此退出函数 +**********************************/ +void HWOCR_ExitPdf(); +/************************************** +功能: 释放识别句柄 +参数: pstOcrHandle [I] 初始化时的句柄 + +返回值:正常返回0,否则<0 +****************************************/ +void HWOCR_SDKExit(void *pstOcrHandle); diff --git a/third_party/ocr/hanvon/uos/amd64/include/ocrcommon.h b/third_party/ocr/hanvon/uos/amd64/include/ocrcommon.h new file mode 100644 index 00000000..72f3da8a --- /dev/null +++ b/third_party/ocr/hanvon/uos/amd64/include/ocrcommon.h @@ -0,0 +1,146 @@ +/*-------------------------------------------------------------------------- + Embedded OCR Engine for embedded platform v1.0 +Copyright (c) 2006HanWang Technology Co., Ltd. All Rights Reserved. + + File: ocrcommon.h + + Description: + common file for embedded OCR module. + + Author: Hanwang Embedded OCR Group + History: + Nov.7, 2006 Created + +---------------------------------------------------------------------------*/ +#ifndef OCRCOMMON_H +#define OCRCOMMON_H + +/*--------------------------------------------------------------------------*/ +/* Typedef's */ +/*--------------------------------------------------------------------------*/ +typedef unsigned char BYTE; +typedef int BOOL; +typedef unsigned short WORD; + +//Data type define +/////////////////////////////////////////////////////////////////////////////// +typedef void (*RecogProgress)( int nPercent); +typedef int (*IsCanceled)(); + +typedef void* (*BCRHeapAlloc)( unsigned int lSize ); +typedef void (*BCRHeapFree)( void *memblock ); + +#define MAX_PATH 260 + + +typedef struct _OCRRect //rectangle +{ + int left; + int top; + int right; + int bottom; +} TOCRRECT; + + +enum TLayoutType //layout text type +{ + ETypeHorizontal, // TYPE_HORIZONTAL, + ETypeVertical // TYPE_VERTICAL +}; + +enum TTextType +{ + ETextMultiLine, //multi-text line + ETextSingleLine //sigle text line +}; +enum TImageBackground //brightness for text background +{ + EBackgroundLight, // dark character with light background + EBackgroundDark, //light character with dark background + EBackgroundUnknown // unknown +}; + + +enum TColorType //color type +{ + EGray2 = 0, //black and white image, 1 bit per pixel + EGray256, // gray image, 8 bit per pixel + EColor16M, // color image, 24 bit per pixel +}; + +struct TOCRTextLineInfo // data structure of text line +{ + char *iText; // during layout analyze, this is null + short *psDistance; + TOCRRECT iRect; // + + TOCRRECT *iCharRect; // This is an array which returns the regions of every single character in this line + int iCharCount; // How many characters in this line +}; + +struct TOCRBlockInfo // data structure of layout infomation +{ + + TOCRRECT iRect; // block coordinates + TLayoutType iType; //vertical or horizontal + int iBlockId; // block's ID + +}; + + +struct TOCRTextRgnInfo // data structure of recognition result +{ + TOCRRECT iRect; // block coordinates + TLayoutType iType; //vertical or horizontal + int iBlockId; // block's ID + + TOCRTextLineInfo *iLines; + int iLineCount; // Lines' count in each block +}; + + +struct TOCRLayoutSetting // data structure of layout settings +{ + enum TBrightness // brightness + { + ENormal, // Normal + ELight, // Light + EDark // Dark + }; + + int iSkew; // switch of skew adjustment 1: do skew adjustment; 0: dont do it + TBrightness iBrightness; // switch of brightness adjustment +}; + +struct TOCRRecognizeSetting // data structure of Recognition settings +{ + int iRotate; + void* iCandidate; // for later usage +}; + + +struct TOCRLayoutBlockInfo // COCRLayoutBlockInfo +{ + TOCRRECT iRect; //block coordinates + TLayoutType iLayout; //vertical or horzontal text + TTextType iText; //mulitline or single line + TImageBackground iBackgroundColor;//brightness for text background +}; + + + +struct TRegionInfo +{ + TOCRRECT iRect; + TImageBackground iBackgroundColor; + + enum TRegionType + { + EEmailAddress, + ETelephoneNumber, + EWWWAddress + }; + + TRegionType iType; +}; +#endif diff --git a/third_party/ocr/hanvon/uos/mips64/include/hanwangOCRdetect.h b/third_party/ocr/hanvon/uos/mips64/include/hanwangOCRdetect.h new file mode 100644 index 00000000..800e1f42 --- /dev/null +++ b/third_party/ocr/hanvon/uos/mips64/include/hanwangOCRdetect.h @@ -0,0 +1,177 @@ +#include "./ocrcommon.h" + +//使用动态库的时候需要将 hwusbdev.key 放到应用程序相同路径 +//文件类型 +#define FILE_PDF 0 //输出精确版面复原的简体PDF文件 +#define FILE_RTF 2 //输出精确版面复原的简体RTF文件 +#define FILE_XLS 5 //输出简体XLS文件 +#define FILE_TXT 100 //输出为文本格式 +#define FILE_PDF_TXT 101 //输出文本加pdf +#define FILE_JSON 200 //输出为json格式 +#define FILE_OFD 300 //输出双层ofd格式 + +#define STATUS_OK 0 +#define STATUS_NO_MEMORY -1 +#define STATUS_INVALID_PARAMETER -2 +#define STATUS_FAILED -3 + +//顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +/************************************** +功能: 初始化 +参数: ppstOcrHandle [I/O] 初始化识别句柄 + +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_SDKInitialize(void **ppstOcrHandle); + +/************************************** +功能:识别jpg/bmp/tiff/png/gif图像文件,输出txt/json/rtf/xls/pdf格式 +参数: ImgFile [I] 输入图像路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。没有传此参数或者传NULL时,必要时会在pLibDir下生成tmp.jpg图像。 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeFile(unsigned char*ImgFile, unsigned char *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir=NULL); + +/************************************** +功能:识别jpg/bmp/tiff/png/gif批量图像文件,输出txt/json/rtf/xls/pdf格式 +参数: ppImageFiles [I] 输入图像路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。没有传此参数或者传NULL时,必要时会在pLibDir下生成jpg图像。 +返回值:正常返回0,否则<0 +****************************************/ + +int HWOCR_RecognizeFileBatch(char ** ppImageFiles, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir = NULL); + + +/************************************** +功能:识别内存图像的指定块,输出txt/json/rtf格式 +参数: pbImage [I] 图像数据 + nWidth [I] 图像宽度 + nHeight [I] 图像高度 + aLayoutInfo [I] 块属性 + nColorType [I] 颜色属性 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] db文件所在目录 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeImgBlock(unsigned char*pbImage, int nWidth, int nHeight, TOCRLayoutBlockInfo aLayoutInfo, + TColorType nColorType, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir); + + +/************************************** +功能:识别jpg/bmp/tiff/png/gif图像文件,输出识别结果字符串 +参数: ImgFile [I] 输入图像路径及文件名 + pstHandle [I] 输入句柄,初始化返回的结果 + ppRst [O] 识别结果字符串 + pnLen [O] 字符串长度 +返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeFile2Str(BYTE*ImgFile, void *pstHandle,char **ppRst,int* pnLen); + + +/************************************** +功能: 释放识别结果 +参数: ppRst [I] 识别结果字符串 + +返回值: 无 +****************************************/ +void HWOCR_FreeStrRst(char **ppRst); + +/************************************** +功能: 判断识别方向 +参数: ImgFile [I] 输入图像路径及文件名 + pstHandle [I] 输入句柄,初始化返回的结果 + pDirect [O] 图像方向 + //顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +返回值: 正常为0,否则<0 +****************************************/ +int HWOCR_GetFileDirect(BYTE*ImgFile, void *pstHandle, int *pDirect); + + +/************************************** +功能: 判断识别方向,支持24bit 8bit 1bit内存图像。 +参数: pbImage [I] 输入内存图像 + nWidth [I] 图像宽度 + nHeight [I] 图像高度 + nColorType [I] 颜色属性 + pstHandle [I] 输入句柄,初始化返回的结果 + pDirect [O] 图像方向 + //顺时针角度 +enum ROTATETYPEOUT +{ + ROT0, //未旋转 + ROT90, //顺时针旋转90度 + ROT180, //顺时针旋转180度 + ROT270, //顺时针旋转270度 +}; + +返回值: 正常为0,否则<0 +****************************************/ + +int HWOCR_GetFileDirectImage(BYTE*pbImage, int nWidth, int nHeight, TColorType nColorType, void *pstHandle, int *pDirect); + +/************************************** +功能:识别ofd图像文件,输出txt/json/rtf/xls/pdf/ofd格式 +参数: OfdFile [I] 输入文件路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] 传NULL + pTmpDir [I] 保存临时文件的目录,需要有写权限,有时需要生成tmp.jpg文件。 + 返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizeOFD(BYTE*OfdFile, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir); + +/************************************** +功能:识别pdf图像文件,输出txt/json/rtf/xls/pdf/ofd格式 +参数: PdfFile [I] 输入文件路径及文件名 + OutFile [I] 输出文件名 + nFileType [I] 输出文件类型 + pstHandle [I] 输入句柄,初始化返回的结果 + pLibDir [I] 传NULL + pTmpDir [I] 保存临时文件的目录,需要有写权限。 + 返回值:正常返回0,否则<0 +****************************************/ +int HWOCR_RecognizePDF(BYTE*PdfFile, BYTE *OutFile, int nFileType, void *pstHandle, char *pLibDir, char *pTmpDir); + +/********************************* +功能:调用识别pdf函数前,调用此初始化函数 +**********************************/ +void HWOCR_InitPdf(); + +/********************************* +功能:调用识别pdf函数后,调用此退出函数 +**********************************/ +void HWOCR_ExitPdf(); +/************************************** +功能: 释放识别句柄 +参数: pstOcrHandle [I] 初始化时的句柄 + +返回值:正常返回0,否则<0 +****************************************/ +void HWOCR_SDKExit(void *pstOcrHandle); diff --git a/third_party/ocr/hanvon/uos/mips64/include/ocrcommon.h b/third_party/ocr/hanvon/uos/mips64/include/ocrcommon.h new file mode 100644 index 00000000..72f3da8a --- /dev/null +++ b/third_party/ocr/hanvon/uos/mips64/include/ocrcommon.h @@ -0,0 +1,146 @@ +/*-------------------------------------------------------------------------- + Embedded OCR Engine for embedded platform v1.0 +Copyright (c) 2006HanWang Technology Co., Ltd. All Rights Reserved. + + File: ocrcommon.h + + Description: + common file for embedded OCR module. + + Author: Hanwang Embedded OCR Group + History: + Nov.7, 2006 Created + +---------------------------------------------------------------------------*/ +#ifndef OCRCOMMON_H +#define OCRCOMMON_H + +/*--------------------------------------------------------------------------*/ +/* Typedef's */ +/*--------------------------------------------------------------------------*/ +typedef unsigned char BYTE; +typedef int BOOL; +typedef unsigned short WORD; + +//Data type define +/////////////////////////////////////////////////////////////////////////////// +typedef void (*RecogProgress)( int nPercent); +typedef int (*IsCanceled)(); + +typedef void* (*BCRHeapAlloc)( unsigned int lSize ); +typedef void (*BCRHeapFree)( void *memblock ); + +#define MAX_PATH 260 + + +typedef struct _OCRRect //rectangle +{ + int left; + int top; + int right; + int bottom; +} TOCRRECT; + + +enum TLayoutType //layout text type +{ + ETypeHorizontal, // TYPE_HORIZONTAL, + ETypeVertical // TYPE_VERTICAL +}; + +enum TTextType +{ + ETextMultiLine, //multi-text line + ETextSingleLine //sigle text line +}; +enum TImageBackground //brightness for text background +{ + EBackgroundLight, // dark character with light background + EBackgroundDark, //light character with dark background + EBackgroundUnknown // unknown +}; + + +enum TColorType //color type +{ + EGray2 = 0, //black and white image, 1 bit per pixel + EGray256, // gray image, 8 bit per pixel + EColor16M, // color image, 24 bit per pixel +}; + +struct TOCRTextLineInfo // data structure of text line +{ + char *iText; // during layout analyze, this is null + short *psDistance; + TOCRRECT iRect; // + + TOCRRECT *iCharRect; // This is an array which returns the regions of every single character in this line + int iCharCount; // How many characters in this line +}; + +struct TOCRBlockInfo // data structure of layout infomation +{ + + TOCRRECT iRect; // block coordinates + TLayoutType iType; //vertical or horizontal + int iBlockId; // block's ID + +}; + + +struct TOCRTextRgnInfo // data structure of recognition result +{ + TOCRRECT iRect; // block coordinates + TLayoutType iType; //vertical or horizontal + int iBlockId; // block's ID + + TOCRTextLineInfo *iLines; + int iLineCount; // Lines' count in each block +}; + + +struct TOCRLayoutSetting // data structure of layout settings +{ + enum TBrightness // brightness + { + ENormal, // Normal + ELight, // Light + EDark // Dark + }; + + int iSkew; // switch of skew adjustment 1: do skew adjustment; 0: dont do it + TBrightness iBrightness; // switch of brightness adjustment +}; + +struct TOCRRecognizeSetting // data structure of Recognition settings +{ + int iRotate; + void* iCandidate; // for later usage +}; + + +struct TOCRLayoutBlockInfo // COCRLayoutBlockInfo +{ + TOCRRECT iRect; //block coordinates + TLayoutType iLayout; //vertical or horzontal text + TTextType iText; //mulitline or single line + TImageBackground iBackgroundColor;//brightness for text background +}; + + + +struct TRegionInfo +{ + TOCRRECT iRect; + TImageBackground iBackgroundColor; + + enum TRegionType + { + EEmailAddress, + ETelephoneNumber, + EWWWAddress + }; + + TRegionType iType; +}; +#endif diff --git a/third_party/ocr/hanvon/uos/mips64/lib/hwusbdev.key b/third_party/ocr/hanvon/uos/mips64/lib/hwusbdev.key new file mode 100644 index 00000000..68551578 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/hwusbdev.key differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libcnocr.so b/third_party/ocr/hanvon/uos/mips64/lib/libcnocr.so new file mode 100644 index 00000000..66ad4523 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libcnocr.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libconvert.so b/third_party/ocr/hanvon/uos/mips64/lib/libconvert.so new file mode 100644 index 00000000..8c2bbcb2 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libconvert.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libdocseg.so b/third_party/ocr/hanvon/uos/mips64/lib/libdocseg.so new file mode 100644 index 00000000..3b2e1b78 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libdocseg.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libexportfile.so b/third_party/ocr/hanvon/uos/mips64/lib/libexportfile.so new file mode 100644 index 00000000..6f66f7a7 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libexportfile.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libhwocrdetect.so b/third_party/ocr/hanvon/uos/mips64/lib/libhwocrdetect.so new file mode 100644 index 00000000..d7280e1d Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libhwocrdetect.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libhwocrjni.so b/third_party/ocr/hanvon/uos/mips64/lib/libhwocrjni.so new file mode 100644 index 00000000..3e8711b9 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libhwocrjni.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libofd.so b/third_party/ocr/hanvon/uos/mips64/lib/libofd.so new file mode 100644 index 00000000..13bdae05 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libofd.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libpdfparse.so b/third_party/ocr/hanvon/uos/mips64/lib/libpdfparse.so new file mode 100644 index 00000000..d82b76c2 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libpdfparse.so differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libtinyxml2.so.8 b/third_party/ocr/hanvon/uos/mips64/lib/libtinyxml2.so.8 new file mode 100644 index 00000000..88998ba9 Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libtinyxml2.so.8 differ diff --git a/third_party/ocr/hanvon/uos/mips64/lib/libzip.so.5 b/third_party/ocr/hanvon/uos/mips64/lib/libzip.so.5 new file mode 100644 index 00000000..63813cef Binary files /dev/null and b/third_party/ocr/hanvon/uos/mips64/lib/libzip.so.5 differ