0
res = cv.matchTemplate(img_gray,template,cv.TM_CCOEFF_NORMED)
threshold = 0.8
loc = np.where( res >= threshold)
for pt in zip(*loc[::-1]):
    cv.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,0,255), 2)

(以上代码由https://docs.opencv.org/4.5.2/d4/dc6/tutorial_py_template_matching.html提供)

但是,pt 只包含点的 x 和 y 坐标但没有分数,有没有办法在阈值处理后获得 loc 中那些匹配点的分数?

PS:我正在尝试匹配图像中的多次出现,所以 minmaxLoc 对我不起作用。

4

0 回答 0