110 lines
2.4 KiB
C
110 lines
2.4 KiB
C
// HWOCR库头文件
|
||
// hhoking 2017
|
||
//
|
||
#pragma once
|
||
#include "hwocr.h"
|
||
|
||
#if SDK_TABLE
|
||
|
||
typedef struct tagHWCell
|
||
{
|
||
int rowStart; // 行起始逻辑号(0起始)
|
||
int rowEnd; // 行结束逻辑号
|
||
int colStart; // 列起始逻辑号(0起始)
|
||
int colEnd; // 列结束逻辑号
|
||
RECT rect; // 单元格待识别块区域
|
||
HWBlock* block; // 识别信息
|
||
#ifdef HWOCR_LIBSRC
|
||
tagHWCell() { memset(this, 0, sizeof(tagHWCell)); }
|
||
~tagHWCell()
|
||
{
|
||
if (block)
|
||
delete block;
|
||
}
|
||
#endif
|
||
}
|
||
HWCell;
|
||
|
||
typedef struct tagHWTable
|
||
{
|
||
int rowCount; // 逻辑行数
|
||
int colCount; // 逻辑列数
|
||
int cellCount; // 单元格数
|
||
HWCell* cells; // 单元格
|
||
#ifdef HWOCR_LIBSRC
|
||
tagHWTable() { memset(this, 0, sizeof(tagHWTable)); }
|
||
~tagHWTable()
|
||
{
|
||
if (cells)
|
||
delete [] cells;
|
||
}
|
||
#endif
|
||
}
|
||
HWTable;
|
||
|
||
typedef struct tagHWRegion
|
||
{
|
||
RECT rect; // 块区域
|
||
BLKTYPE type; // 块类型(BT_TEXT、BT_IMAGE、BT_TABLE)
|
||
void* block; // 块指针
|
||
#ifdef HWOCR_LIBSRC
|
||
tagHWRegion() { memset(this, 0, sizeof(tagHWRegion)); }
|
||
~tagHWRegion()
|
||
{
|
||
if (block)
|
||
{
|
||
if (type == BT_TABLE)
|
||
delete (HWTable *)block;
|
||
else
|
||
delete (HWBlock *)block;
|
||
}
|
||
}
|
||
#endif
|
||
}
|
||
HWRegion;
|
||
|
||
typedef struct tagHWResult2
|
||
{
|
||
HWRegion* blocks; // 块信息结构指针
|
||
int blockCount; // 块个数
|
||
#ifdef HWOCR_LIBSRC
|
||
tagHWResult2() { memset(this, 0, sizeof(tagHWResult2)); }
|
||
~tagHWResult2()
|
||
{
|
||
if (blocks)
|
||
delete [] blocks;
|
||
}
|
||
#endif
|
||
}
|
||
HWResult2;
|
||
|
||
HWOCR_ADV_API HWResult2* socrTabRecognize(szpath filename, szpath dbpath = NULL);
|
||
|
||
HWOCR_ADV_API HWResult2* socrTabRecognize2(HWIMAGE img, szpath dbpath = NULL);
|
||
|
||
HWOCR_ADV_API void socrTabFreeResult(HWResult2* ptr);
|
||
|
||
#endif
|
||
|
||
#if SDK_DIRECTION
|
||
|
||
// 获取方向
|
||
// thres - 阈值[(质量好的图)30 - 50(质量不好的图)]
|
||
// 返回值:0 - 正向;90 - 左旋90;180 - 旋转180;270 - 右旋90
|
||
HWOCR_ADV_API int socrGetDirection(szpath filename, int thres = 40);
|
||
|
||
// 获取方向新方法
|
||
HWOCR_ADV_API int socrGetDirectionEx(szpath filename);
|
||
// scan0 - 图像光栅数据,要求8位灰度,正向,行单字节对齐
|
||
HWOCR_ADV_API int socrGetDirectionEx2(puchar scan0, int w, int h);
|
||
|
||
#endif
|
||
|
||
#if SDK_STAMP
|
||
|
||
HWOCR_ADV_API bool socrRemoveSeal(HWIMAGE img);
|
||
|
||
// 识别带印章的文本
|
||
HWOCR_API pwchar socrRecognizeWithSeal(szpath filename, szpath dbpath = NULL);
|
||
|
||
#endif |