From b89e5e96d3dec405426a70e4e50e59c2cd7ceab4 Mon Sep 17 00:00:00 2001 From: 283375 Date: Wed, 13 Sep 2023 02:55:38 +0800 Subject: [PATCH] feat: `imread_unicode` can now pass `flags` to `cv2.imdecode` --- src/arcaea_offline_ocr/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arcaea_offline_ocr/utils.py b/src/arcaea_offline_ocr/utils.py index e968dce..e55ea0f 100644 --- a/src/arcaea_offline_ocr/utils.py +++ b/src/arcaea_offline_ocr/utils.py @@ -11,10 +11,10 @@ from .types import Mat, XYWHRect __all__ = ["imread_unicode"] -def imread_unicode(filepath: str) -> Mat: +def imread_unicode(filepath: str, flags: int = cv2.IMREAD_UNCHANGED) -> Mat: # https://stackoverflow.com/a/57872297/16484891 # CC BY-SA 4.0 - return cv2.imdecode(np.fromfile(filepath, dtype=np.uint8), cv2.IMREAD_UNCHANGED) + return cv2.imdecode(np.fromfile(filepath, dtype=np.uint8), flags) def construct_int_xywh_rect(