template_matching.py 文件源码

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

项目:cv-utils 作者: gmichaeljaison 项目源码 文件源码
def multi_feat_match(template, image, options=None):
    """
    Match template and image by extracting multiple features (specified) from it.

    :param template: Template image
    :param image:  Search image
    :param options: Options include
        - features: List of options for each feature
    :return:
    """
    h, w = image.shape[:2]
    scale = 1
    if options is not None and 'features' in options:
        heatmap = np.zeros((h, w), dtype=np.float64)
        for foptions in options['features']:
            f_hmap, _ = feature_match(template, image, foptions)
            heatmap += cv.resize(f_hmap, (w, h), interpolation=cv.INTER_AREA)
        heatmap /= len(options['features'])
    else:
        heatmap, scale = feature_match(template, image, options)
    return heatmap, scale
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号