1、在大图中找小图
// 先读取文件
var img1 = images.read("/sdcard/AutoTest/bg.png") // 当然jpg 的图片也是支持的
var img2 = images.read("/sdcard/AutoTest/icon.png")
// 语法糖 findImage(img, template, options)
// img 大图
// template 要找的图片
// options 对象 {threshold ,region, level}
// threshold: 0.9, 默认0.9 范围(1-9) 相似度
// region: [x, y] 找图的区域
// level: number 一般不做修改
// 图片比对
var result = findImage(img2, img1,{threshold:}) // 找到返回true, 失败返回false
if(result){
toast("找到啦:" + result);
}else{
toast("没找到");
}
2、
大图找小图实战
本文介绍了一种在大图像中查找特定小图像的方法,通过使用findImage函数,该函数接受大图、模板图片和选项参数,实现图像匹配。文章详细展示了如何读取图像文件并进行比较,设置相似度阈值等参数。
5615





