指定图片识字(自定义模型) - OcrFromPtrEx
函数简介
对内存图像句柄进行 OCR,使用指定模型句柄。
接口名称
OcrFromPtrEx
DLL 调用
long OcrFromPtrEx(long ola, long ptr, long modelHandle);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。 |
| ptr | 长整数型 | 图像句柄(如 LoadImage 返回值) |
| modelHandle | 长整数型 | 模型句柄;内置 mobile 为 0,自定义包为 OcrLoadModel 返回值 |
示例
C++
long instance = CreateCOLAPlugInterFace();
long img = LoadImage(instance, "D:\\test.bmp");
long resultPtr = OcrFromPtrEx(instance, img, 0);
char* text = GetStringFromPtr(instance, resultPtr);
FreeStringPtr(instance, resultPtr);
Python
# 待补充
返回值
字符串指针,识别文本。须 FreeStringPtr 释放。
注意事项
- 结果坐标相对图像左上角。
