Last active
March 19, 2019 07:33
-
-
Save diewland/440dd5091ef0e862d42b78ddc55cbc8a to your computer and use it in GitHub Desktop.
cv2 for windows cannot read Thai/unicode image filename, this function resolved this issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/43185606 | |
def cv2_imread_win(img_filepath, np): | |
stream = open(img_filepath, "rb") | |
bytes = bytearray(stream.read()) | |
numpyarray = np.asarray(bytes, dtype=np.uint8) | |
return cv2.imdecode(numpyarray, cv2.IMREAD_UNCHANGED) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment