识别图片排除指定区域 - ExcludePos
函数简介
排除掉指定区域的识别结果,用于颜色识别结果及图像识别结果的过滤。
接口名称
ExcludePos
DLL调用
long ExcludePos(long ola, char* json, int type, int x1, int y1, int x2, int y2);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| json | 字符串 | 识别返回的结果 |
| type | 整数型 | 识别类型:1 颜色识别,2 图像识别 |
| x1 | 整数型 | 排除区域左上角的X坐标 |
| y1 | 整数型 | 排除区域左上角的Y坐标 |
| x2 | 整数型 | 排除区域右下角的X坐标 |
| y2 | 整数型 | 排除区域右下角的Y坐标 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 假设 jsonResult 为颜色识别返回的JSON结果
char* jsonResult = "..."; // 识别结果
// 排除区域(0,0)-(100,100)内的颜色识别结果
long ptr = ExcludePos(instance, jsonResult, 1, 0, 0, 100, 100);
char* filtered = GetStringFromPtr(instance, ptr);
FreeStringPtr(instance, ptr);
Python
# 待补充
返回值
返回排除掉指定区域后的结果JSON字符串指针。
返回的字符串指针需要调用 FreeStringPtr 释放内存。
