坐标点排序 - SortPosDistance
函数简介
根据坐标点距离排序,用于颜色识别结果及图像识别结果的排序。
接口名称
SortPosDistance
DLL调用
long SortPosDistance(long ola, char* json, int type, int x, int y);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| json | 字符串 | 识别结果返回值 |
| type | 整数型 | 识别类型:1 颜色识别,2 图像识别 |
| x | 整数型 | 锚点的X坐标 |
| y | 整数型 | 锚点的Y坐标 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 假设 jsonResult 为颜色识别返回的JSON结果
char* jsonResult = "..."; // 识别结果
// 以坐标(100,100)为锚点,按距离排序颜色识别结果
long ptr = SortPosDistance(instance, jsonResult, 1, 100, 100);
char* sorted = GetStringFromPtr(instance, ptr);
FreeStringPtr(instance, ptr);
Python
# 待补充
返回值
返回按距离排序后的坐标点列表字符串指针。
返回的字符串指针需要调用 FreeStringPtr 释放内存。
