chore: partial numpy & cv2 import to full import

This commit is contained in:
2023-08-09 19:05:17 +08:00
parent 920ceffb35
commit 64598d0a84
7 changed files with 41 additions and 60 deletions

View File

@ -1,9 +1,8 @@
from collections.abc import Iterable
from typing import Callable, Tuple, TypeVar, Union, overload
from cv2 import IMREAD_UNCHANGED, imdecode
from numpy import fromfile as np_fromfile
from numpy import uint8
import cv2
import numpy as np
from .types import Mat, XYWHRect
@ -13,7 +12,7 @@ __all__ = ["imread_unicode"]
def imread_unicode(filepath: str) -> Mat:
# https://stackoverflow.com/a/57872297/16484891
# CC BY-SA 4.0
return imdecode(np_fromfile(filepath, dtype=uint8), IMREAD_UNCHANGED)
return cv2.imdecode(np.fromfile(filepath, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
def construct_int_xywh_rect(