diff --git a/ocv_corner_tracker.py b/ocv_corner_tracker.py index 077b5e4..c0ad4f2 100644 --- a/ocv_corner_tracker.py +++ b/ocv_corner_tracker.py @@ -56,14 +56,12 @@ class Corner: def process(self, _image: np.array): _image_anno = _image.copy() - crop_scaled = im.resize(_image, IMG_SCALE_UP * _image.shape[1], IMG_SCALE_UP * _image.shape[0]) + template = self.ref['image'] bb_template = self.ref['bbox'] - # Resize template - template_scaled = im.resize(template, IMG_SCALE_UP * template.shape[0], IMG_SCALE_UP * template.shape[1]) # Match - matcher_res = cv2.matchTemplate(crop_scaled, template_scaled, cv2.TM_CCOEFF_NORMED) + matcher_res = cv2.matchTemplate(_image, template, cv2.TM_CCOEFF_NORMED) (min_val, max_val, min_loc, max_loc) = cv2.minMaxLoc(matcher_res) # Get matcher coord @@ -83,7 +81,7 @@ class Corner: matcher_bbox_local = (matcher_start_x, matcher_start_y, template.shape[1], template.shape[0]) - self._debug(_image_anno, matcher_res, matcher_start_x, matcher_start_y, template_scaled, crop_scaled) + self._debug(_image_anno, matcher_res, matcher_start_x, matcher_start_y, template, _image) return matcher_bbox_local, matcher_res