python从图片中找图

import aircv as ac
def matcha(bb,aa):#从bb查找aa,如果有则返回其坐标位置
    yuan=ac.imread(bb)
    mubi=ac.imread(aa)
    result=ac.find_template(yuan,mubi,0.7)#0.7相似度
    if(result!=None):        
        return result['result'][0],result['result'][1]
        #return yuan.shape[1],yuan.shape[0]
    return None

aa="./xm1.png"
bb="./tmall4a.png"
dd=matcha(bb,aa)
print(dd)

结果:

(90.0, 429.0)

posted @ 2020-12-21 17:24  myrj  阅读(3169)  评论(0)    收藏  举报