find_best_match.py 文件源码

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

项目:CV-lecture-quizzes-python 作者: pdvelez 项目源码 文件源码
def find_best_match(patch, strip):
    # TODO: Find patch in strip and return column index (x value) of topleft corner

    # We will use SSD to find out the best match

    best_id = 0
    min_diff = np.infty

    for i in range(int(strip.shape[1] - patch.shape[1])):
        temp = strip[:, i: i + patch.shape[1]]
        ssd = np.sum((temp - patch) ** 2)
        if ssd < min_diff:
            min_diff = ssd
            best_id = i

    return best_id

# Test code:

# Load images
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号