import aircv as ac
import pyautogui

def matchImg(imgsrc, imgobj, confidencevalue=0.5): # imgsrc=原始图像,imgobj=待查找的图片
imsrc = ac.imread(imgsrc)
imobj = ac.imread(imgobj)

match_result = ac.find_template(imsrc, imobj,confidencevalue) # {'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

imgsrc = "b.png"
imgobj = "a.png"
match_result = matchImg(imgsrc, imgobj)
print(match_result)

相关文章:

  • 2021-11-16
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-01
  • 2021-11-17
  • 2021-12-20
  • 2021-10-23
  • 2021-07-21
  • 2022-12-23
相关资源
相似解决方案