feat: imread_unicode can now pass flags to cv2.imdecode

This commit is contained in:
283375 2023-09-13 02:55:38 +08:00
parent 92c4945037
commit b89e5e96d3
Signed by: 283375
SSH Key Fingerprint: SHA256:UcX0qg6ZOSDOeieKPGokA5h7soykG61nz2uxuQgVLSk

View File

@ -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(