- 증상
#imagePath에 한글 경로 존재 시
import cv2
img = cv2.imread(imagePath, -1) # img = None
print(np.shape(img)) # ()
- 해결
# numpy fromfile, cv2 imdecode를 사용하여 해결
import numpy as np
import cv2
ff = np.fromfile(imagePath, np.uint8)
img = cv2.imdecode(ff, cv2.IMREAD_UNCHANGED) # img = array
print(np.shape(img)) # (w, h, scale)
- 참고 (OpenCV API Documentation)
'프로그래밍 관련 > [Python] 간단 해결' 카테고리의 다른 글
[Python] PermissionError: [Errno 13] Permission denied: Path... (0) | 2020.05.21 |
---|---|
[Python] UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 17533: illegal multibyte sequence (0) | 2020.05.21 |
[Python] json.dumps() 한글 > 유니코드로 저장될 때 (0) | 2020.04.22 |
[Python] OSError: mysql_config not found (Ubuntu 16.04) (0) | 2020.04.20 |
[CUDA] Windows10에서 간단하게 CUDA 사용률 확인하는 방법 (0) | 2020.02.14 |