Tablet.py 文件源码

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

项目:CameraTablet 作者: dmvlasenk 项目源码 文件源码
def matchTemplate(self, img_full, img_template, aMeth):
        w, h = img_template.shape[::-1]
        img = img_full.copy()
        # Apply template Matching
        method = eval(aMeth)
        res = cv2.matchTemplate(img,img_template,method)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)

        # If the method is TM_SQDIFF or TM_SQDIFF_NORMED, take minimum
        if method in [cv2.TM_SQDIFF, cv2.TM_SQDIFF_NORMED]:
            top_left = min_loc
        else:
            top_left = max_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)
        return [top_left, bottom_right]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号