optimize FPS: removed image resize

This commit is contained in:
2024-07-06 15:52:41 +02:00
parent d800adab36
commit 546020f971
+3 -5
View File
@@ -56,14 +56,12 @@ class Corner:
def process(self, _image: np.array): def process(self, _image: np.array):
_image_anno = _image.copy() _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'] template = self.ref['image']
bb_template = self.ref['bbox'] 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 # 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) (min_val, max_val, min_loc, max_loc) = cv2.minMaxLoc(matcher_res)
# Get matcher coord # Get matcher coord
@@ -83,7 +81,7 @@ class Corner:
matcher_bbox_local = (matcher_start_x, matcher_start_y, template.shape[1], template.shape[0]) 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 return matcher_bbox_local, matcher_res