查找图片 - FindImageFromPath
函数简介
在指定图片中查找指定图像(使用文件路径),返回第一个匹配结果。源与模板均通过文件路径指定,模板支持多图(如 "test.bmp|test2.bmp|test3.bmp")。
返回数据类型解析:
{
"MatchVal": 0.85,
"MatchState": true,
"Index": 0,
"X": 100,
"Y": 200,
"Width":100,
"Height":100
}
接口名称
FindImageFromPath
DLL调用
long FindImageFromPath(long instance, string source, string templ, string deltaColor, double matchVal, int dir)
参数定义:
instance(长整型数): OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。source(字符串): 源图片的路径。templ(字符串): 模板图片的路径,可以是多个图片,如 "test.bmp|test2.bmp|test3.bmp"。deltaColor(字符串): 颜色差值,格式为"RRGGBB",如"101010"。matchVal(双精度浮点数): 相似度,如0.85,最大为1。dir(整型数): 查找方向:- 0:从左到右,从上到下
- 1:从左到右,从下到上
- 2:从右到左,从上到下
- 3:从右到左,从下到上
- 4:从中心往外查找
- 5:从上到下,从左到右
- 6:从上到下,从右到左
- 7:从下到上,从左到右
- 8:从下到上,从右到左
示例:
待补充...
返回值
匹配结果(单条),格式同上 JSON。
注意:
DLL调用返回字符串指针地址,需要调用 FreeStringPtr 接口释放内存。
