From b853036dc3ecef9ca5d89c17a0cbacd4b6f7dae0 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Thu, 14 Sep 2023 03:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E8=AF=95=E6=B0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/cv2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/cv2.py b/utils/cv2.py index d8a03f8..1bb5569 100644 --- a/utils/cv2.py +++ b/utils/cv2.py @@ -6,14 +6,14 @@ from PIL.Image import Image import utils.matplotlib -def match_resize(src: Image, tmpl: str, similarity=0.9, step=20, fast=False): +def match_resize(src: Image, tmpl: str, similarity=0.9, step=10, fast=False): src = cv2.cvtColor(np.asarray(src), cv2.COLOR_RGB2BGR) src_gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY) tmpl = cv2.imread(tmpl) tmpl_gray = cv2.cvtColor(tmpl, cv2.COLOR_BGR2GRAY) found = None tmp_r = 0 - for scale in np.linspace(0.2, 1.0, step)[::-1]: + for scale in np.linspace(0.2, 2, step)[::-1]: # 根据scale比例缩放图像,并保持其宽高比 resized = imutils.resize(src_gray, width=int(src_gray.shape[1] * scale)) r = src_gray.shape[1] / float(resized.shape[1])