mirror of
https://github.com/serengil/deepface.git
synced 2025-07-23 10:20:03 +00:00
Merge pull request #735 from RayVik/master
Fix bug with unicode filenames
This commit is contained in:
commit
9e8bdff845
@ -103,7 +103,15 @@ def load_image(img):
|
|||||||
if os.path.isfile(img) is not True:
|
if os.path.isfile(img) is not True:
|
||||||
raise ValueError(f"Confirm that {img} exists")
|
raise ValueError(f"Confirm that {img} exists")
|
||||||
|
|
||||||
return cv2.imread(img)
|
# For reading images with unicode names
|
||||||
|
with open(img, "rb") as img_f:
|
||||||
|
chunk = img_f.read()
|
||||||
|
chunk_arr = np.frombuffer(chunk, dtype=np.uint8)
|
||||||
|
img = cv2.imdecode(chunk_arr, cv2.IMREAD_COLOR)
|
||||||
|
|
||||||
|
return img
|
||||||
|
# This causes troubles when reading files with non english names
|
||||||
|
# return cv2.imread(img)
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user