1.pycharm-3.8环境,代码,ddddocr库,以及测试图片
2.代码:
- import ddddocr
- ocr = ddddocr.DdddOcr(old=True)
- with open("1.jpg", 'rb') as f:
- image = f.read()
- res = ocr.classification(image)
- print(res)
-
3.完整打包,上传到自己的百度网盘。
中途遇到的困难:Traceback (most recent call last):
File "C:\Users\zhangb\Desktop\聚宽一键通-项目组\v1.3.1项目\demo.py", line 5, in
res = ocr.classification(image)
File "C:\Users\zhangb\Desktop\聚宽一键通-项目组\v1.3.1项目\venv\lib\site-packages\ddddocr\__init__.py", line 1614, in classification
image = image.resize((int(image.size[0] * (64 / image.size[1])), 64), Image.ANTIALIAS).convert('L')
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
略微修改了一下,修改方式如下,bug解除:
Image.BICUBIC
介绍结束,完毕