From c275f8cb7e343d382a0a1d588ccfa79865710814 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Mon, 6 Jul 2026 16:30:46 +0800 Subject: [PATCH] perf: optimize image cropping by avoiding unnecessary copies --- module/ocr/ocr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/ocr/ocr.py b/module/ocr/ocr.py index e23d37b..828b6d2 100644 --- a/module/ocr/ocr.py +++ b/module/ocr/ocr.py @@ -119,7 +119,7 @@ class Ocr: # pre process start_time = time.time() if not direct_ocr: - image = crop(image, self.button.area) + image = crop(image, self.button.area, copy=False) image = self.pre_process(image) # ocr result, _ = self.model.ocr_single_line(image) @@ -162,7 +162,7 @@ class Ocr: # pre process start_time = time.time() if not direct_ocr: - image = crop(image, self.button.area) + image = crop(image, self.button.area, copy=False) image = self.pre_process(image) # ocr results: list[BoxedResult] = self.model.detect_and_ocr(image)