指定区域详细信息(自定义模型) - OcrDetailsEx
函数简介
识别窗口区域内文字并返回 JSON 详情,使用指定模型。x1、y1、x2、y2 传 0, 0, 0, 0 为整个客户区。
接口名称
OcrDetailsEx
DLL 调用
long OcrDetailsEx(long ola, int x1, int y1, int x2, int y2, long modelHandle);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。 |
| x1 | 整数型 | 区域左上角 X |
| y1 | 整数型 | 区域左上角 Y |
| x2 | 整数型 | 区域右下角 X |
| y2 | 整数型 | 区域右下角 Y |
| modelHandle | 长整数型 | 模型句柄;内置 mobile 为 0,自定义包为 OcrLoadModel 返回值 |
示例
C++
long instance = CreateCOLAPlugInterFace();
BindWindow(instance, hwnd, 0, 0, 0);
long modelHandle = OcrLoadModel(instance, "D:\\models\\game.omd", "password", 0);
long resultPtr = OcrDetailsEx(instance, 100, 100, 500, 300, modelHandle);
char* json = GetStringFromPtr(instance, resultPtr);
FreeStringPtr(instance, resultPtr);
Python
# 待补充
返回值
字符串指针,JSON 字段说明与 OcrDetails 相同(Regions、Score、Center、Vertices、Angle、Text)。
须 FreeStringPtr 释放。
注意事项
- 坐标相对窗口客户区。
