fix: unicode character in image path

This commit is contained in:
2023-06-23 15:03:35 +08:00
parent c76b656f3d
commit e0009d0836
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,9 @@
from cv2 import IMREAD_UNCHANGED, Mat, imdecode
from numpy import fromfile as np_fromfile
from numpy import uint8
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)