반응형
import cv2
import numpy as np
def isKorean(text):
hangul = re.compile('[\u3131-\u3163\uac00-\ud7a3]+')
result = hangul.findall(text)
if len(result) > 0:
return True
else:
return False
if isKorean(file_path) == True:
img = cv2.imread(file_path, cv2.IMREAD_COLOR)
img = np.fromfile(file_path, np.uint8)
img = cv2.imdecode(img, cv2.IMREAD_COLOR)
elif isKorean(file_path) == False:
img = cv2.imread(file_path, cv2.IMREAD_COLOR)
함수로 해결
반응형
'-------------코딩------------- > python 에러 모음' 카테고리의 다른 글
array to json (TypeError: Object of type ndarray is not JSON serializable) (0) | 2022.04.24 |
---|---|
opencv error - (2) | 2022.04.08 |
OpenCV error (0) | 2022.04.08 |
TypeError: __init__() got an unexpected keyword argument 'size' (0) | 2021.07.16 |
TypeError: expected string or bytes-like object (0) | 2020.10.19 |
댓글