依赖python包|opencv、numpy、aircv
第一步:查找图片在原始图片上的坐标点
import aircv as ac
def matchImg(imgsrc,imgobj,confidencevalue=0.5):#imgsrc=原始图像,imgobj=待查找的图片
imsrc = ac.imread(imgsrc)
imobj = ac.imread(imgobj)
match_result = ac.find_template(imsrc,imobj,confidence) # {'confidence': 0.5435812473297119, 'rectangle': ((394, 384), (394, 416), (450, 384), (450, 416)), 'result': (422.0, 400.0)}
if match_result is not None:
match_result['shape']=(imsrc.shape[1],imsrc.shape[0])#0为高,1为宽
return match_result
说明:通过aircv的find_template()方法,来返回匹配图片的坐标结果
1.入参:
find_template(原始图像imsrc,待查找的图片imobj,最低相似度confidence)
2.返回结果:
{'confidence': 0.5435812473297119, 'rectangle': ((394, 384), (394, 416), (450, 384), (450, 416)), 're