autojs 图片查找比对

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、

猜你喜欢

转载自blog.csdn.net/super__code/article/details/105741862