code_app/third_party/ocr/hanvon/kylin/mips64/include/hanwangOCRdetect.h

178 lines
7.1 KiB
C
Raw Normal View History

#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);