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
find_best_match.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录