Match.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:osrmacro 作者: jjvilm 项目源码 文件源码
def images(img_pat, img_temp,x,y, func):
    w, h = img_temp.shape[::-1]
    try:
        res = cv2.matchTemplate(img_temp,img_pat,cv2.TM_CCOEFF_NORMED)

    except Exception as e:
        print("cannot match")
        print(e)
    threshold = .9 #default is 8 
    loc = np.where( res >= threshold)

    for pt in zip(*loc[::-1]):#goes through each found image
        func(img_pat, x, y, pt, w, h)
        return 0
    return 1

    #return loc to be iterable outisde the function
    #also sometimes width and height of image is needed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号