From 8216aa9e3a1f5dcc8eb9542e2a50ece3359e2acf Mon Sep 17 00:00:00 2001 From: fushall Date: Fri, 22 Jan 2021 19:15:42 +0800 Subject: [PATCH] fix ocr func for Chinese path issus (#1755) --- paddleocr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddleocr.py b/paddleocr.py index 3c3c47ab..db24aa59 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -290,7 +290,9 @@ class PaddleOCR(predict_system.TextSystem): image_file = img img, flag = check_and_read_gif(image_file) if not flag: - img = cv2.imread(image_file) + with open(image_file, 'rb') as f: + np_arr = np.frombuffer(f.read(), dtype=np.uint8) + img = cv2.imdecode(np_arr, cv2.IMREAD_COLOR) if img is None: logger.error("error in loading image:{}".format(image_file)) return None