PaddlePaddle/PaddleOCR

[error] ocr图片解析加载报错

cffycls opened this issue · 4 comments

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

ocr图片解析加载报错。

  • 系统环境/System Environment:
win11
python310
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:
  • main.py
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang="ch", use_gpu=False, show_log=False)

result = ocr.ocr(img_path, cls=True)  # line 35
  • 完整报错/Complete Error Message:
File "D: work\PaddleOCR\main. py”, 1ine 35, in read root
result = ocr.ocr(file path,cls=True)
File "C: \Users\Administrator\AppData\Llocal\Programs\Python\Python310\lib\site-packages\paddleocr\paddleocr.py”, line44,in ocr
img = check_img(img)
File "C: \Users\Administrator\AppData\Llocal\Programs\Python\Python310\lib\site-packages\paddleocr\paddleocr.py”, line38,in check_img
img = img_decode(img_str)
File "C: \Users\Administrator\AppData\Llocal\Programs\Python\Python310\lib\site-packages\paddleocr\paddleocr.py”,line22,in img_decode
return cv2.imdecode(np_arr, cv2.IMREAD COLOR)
cv2. error: OpenC(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave. cp:816: error: (-215:Asertion failed) !buf.empty() in function  cv::imdecode.

cv2. error: OpenC(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave. cp:816: error: (-215:Asertion failed) !buf.empty() in function  cv::imdecode_
GreatV commented

你的图片是空的,看看路径对不对

GreatV commented

你指的是图片地址无效,还是图片内容

检查一下图片路径对不对,用绝对路径试试看。