Fix bug with unicode filenames

This commit is contained in:
RayVik 2023-04-27 15:49:32 +03:00 committed by GitHub
parent 1626b93b08
commit d3f78558ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,7 +103,12 @@ def load_image(img):
if os.path.isfile(img) is not True:
raise ValueError(f"Confirm that {img} exists")
return cv2.imread(img)
img = open(img, "rb")
chunk = img.read()
chunk_arr = np.frombuffer(chunk, dtype=np.uint8)
img = cv2.imdecode(chunk_arr, cv2.IMREAD_COLOR)
return img
# --------------------------------------------------