From 536b39c9b228f601bef8f01dd80b3ee29df433de Mon Sep 17 00:00:00 2001 From: Lele <46496262+antalele@users.noreply.github.com> Date: Wed, 29 Jun 2022 15:59:38 +0200 Subject: [PATCH] rectWidth and rectHeight increase when a smaller pyramid image is correlated to the same dimension template, the rectangle size increase --- TemplateMatching/Python Algorithm/MatchTemplate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TemplateMatching/Python Algorithm/MatchTemplate.py b/TemplateMatching/Python Algorithm/MatchTemplate.py index ecf87e1..1949631 100644 --- a/TemplateMatching/Python Algorithm/MatchTemplate.py +++ b/TemplateMatching/Python Algorithm/MatchTemplate.py @@ -58,8 +58,8 @@ def FindTemplate(pyramid, template, threshold): for index, im in enumerate(pyramid): nccImage = ncc.normxcorr2D(im, template) # Get the normalized correlation of the template onto the im - rectWidth = newTemplateWidth * (0.75 ** index) # Update template rectangle size - rectHeight = newTemplateHeight * (0.75 ** index) # Update template rectangle size + rectWidth = newTemplateWidth / (0.75 ** index) # Update template rectangle size + rectHeight = newTemplateHeight / (0.75 ** index) # Update template rectangle size for row in range(nccImage.shape[0]): for col in range(nccImage.shape[1]): if(nccImage[row][col] > threshold):