查找指定颜色范围坐标 - FindMultiColorListFromPtr
函数简介
查找图片中符合指定颜色范围的所有颜色点,返回坐标列表。
接口名称
FindMultiColorListFromPtr
DLL调用
long FindMultiColorListFromPtr(long ola, long imgPtr, string colorList, string pointColorList, double sim);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| imgPtr | 长整数型 | OLAImage对象的地址 |
| colorList | 字符串 | 颜色模型配置字符串,格式说明见 颜色模型说明 - ColorModel。JSON格式示例:[{"StartColor":"3278FA","EndColor":"6496FF","Type":0}];简化格式示例:3278FA~6496FF |
| pointColorList | 字符串 | 点阵颜色列表,格式说明见 点阵颜色列表格式说明 |
| sim | 双精度浮点数 | 相似度,取值范围 [0~1.0] |
示例
long result = FindMultiColorListFromPtr(ola, imagePtr, "[{\"StartColor\":\"3278FA\",\"EndColor\":\"6496FF\",\"Type\":0}]", "", 1);
if (result != 0) {
printf("找到颜色点列表:%s\n", (char*)result);
FreeStringPtr(ola, result);
}
返回值
长整数型:返回坐标点列表的JSON字符串指针,格式为 [{"x":1,"y":2},{"x":2,"y":1}]。失败返回0。
注意事项
- 返回的字符串指针需调用 FreeStringPtr 释放内存。
- 确保传入的图片指针有效。
