我试图从 match_template 中理解某人的代码,但我无法理解下面的过程。假设有一张照片他要切几部分。图片保存在:
ImagenTotal = np.asarray(Image.open('./redmangos.jpg'))
然后他在该图片上选择了 2 个位置,坐标为:
puntosinteres = [[189.7038558467742, 111.99546370967738],[211.1748235887097, 187.9696572580645]]
由于 match_template 需要两个参数 - 一个是原始图片,另一个是他将用来比较的内容。那么下面的流程是这样的:
xinteres = int(puntosinteres[0][0])
yinteres = int(puntosinteres[0][1])
radio = 10
imagenband = ImagenTotal[:,:,0]
templateband = ImagenTotal[yinteres - radio : yinteres + radio, xinteres - radio : xinteres + radio, 0]
result= match_template(imagenband, templateband)
result = np.where(result>0.8)
我不知道他想在 imagenband 和 templateband 上做什么。有人可以指点我一个方向吗?
谢谢!