cv.py 文件源码

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

项目:endless-lake-player 作者: joeydong 项目源码 文件源码
def match_template(screenshot, template):
    # Perform match template calculation
    matches = cv2.matchTemplate(screenshot, template, cv2.TM_CCOEFF_NORMED)

    # Survey results
    (min_val, max_val, min_loc, max_loc) = cv2.minMaxLoc(matches)

    # Load template size
    (template_height, template_width) = template.shape[:2]

    return {
        "x1": max_loc[0],
        "y1": max_loc[1],
        "x2": max_loc[0] + template_width,
        "y2": max_loc[1] + template_height,
        "center": {
            "x": max_loc[0] + (template_width / 2),
            "y": max_loc[1] + (template_height / 2)
        },
        "score": max_val
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号