Python(Pycharm)集成飞桨OCR

Python(Pycharm)集成飞桨OCR

写的比较糙,引用了很多文章,大家可以直接去引用文章看具体内容
1、更换镜像源为国内清华源,下载起来快一些
参考:

https://blog.csdn.net/weixin_55629186/article/details/132549074?spm=1001.2014.3001.5506

2、按官方文档操作:

https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppstructure/docs/quickstart.md

具体操作如下
2.1 使用CPU
python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

2.2 # 安装 paddleocr,推荐使用2.6版本
pip3 install “paddleocr>=2.6.0.3”

这两个安装完就可以使用测试代码了(我只用OCR识图片,多的代码没贴),
值得注意的是 我没有导入

pip3 install paddleclas>=2.4.3

不需要图像方向分类,所以在image_orientation=True这里替换为False

import os
import cv2
from paddleocr import PPStructure,draw_structure_result,save_structure_res

table_engine = PPStructure(show_log=True, image_orientation=True)

save_folder = './output'
img_path = 'ppstructure/docs/table/1.png'
img = cv2.imread(img_path)
result = table_engine(img)
save_structure_res(result, save_folder,os.path.basename(img_path).split('.')[0])

for line in result:
    line.pop('img')
    print(line)

运行时候报错
在这里插入图片描述
导入了这两个包
pip install utils
pip install logger
还需要再解释器中再次配置。

具体参考: https://blog.csdn.net/lk_mm_love/article/details/121412398
我在解释器中配置就可以了,不需要手动把包粘贴过去。

成功!
成功!

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你想了解关于在PyCharm中使用Python的Tesseract-OCR吗?要使用Tesseract-OCR,你需要安装tesseract-ocr库和pytesseract库。 首先,你需要安装Tesseract-OCR。根据你的操作系统,你可以通过以下方式安装: 对于Windows用户: 1. 访问https://github.com/UB-Mannheim/tesseract/wiki下载Tesseract-OCR的安装文件。 2. 执行安装文件,并按照安装向导的指示进行安装。 对于Mac用户: 1. 使用Homebrew安装Tesseract-OCR。在终端中输入以下命令: ``` brew install tesseract ``` 2. 安装完成后,Tesseract-OCR会自动添加到你的系统路径中。 对于Linux用户: 1. 打开终端,并根据你的Linux发行版输入以下命令来安装Tesseract-OCR: ``` sudo apt-get install tesseract-ocr ``` 或者 ``` sudo yum install tesseract ``` 安装完成后,确保Tesseract-OCR已正确配置并能在终端中使用。你可以在终端中运行以下命令来测试: ``` tesseract --version ``` 接下来,你需要在PyCharm中安装pytesseract库。可以通过以下步骤完成: 1. 打开PyCharm,并创建一个新的Python项目。 2. 在PyCharm的终端中运行以下命令,安装pytesseract: ``` pip install pytesseract ``` 3. 安装完成后,你可以开始在PyCharm中使用pytesseract库来使用Tesseract-OCR了。 下面是一个简单的示例代码,演示如何在PyCharm中使用pytesseract库进行图像文字识别: ```python import pytesseract from PIL import Image # 打开图像 image = Image.open('image.jpg') # 使用pytesseract进行文字识别 text = pytesseract.image_to_string(image) # 输出识别结果 print(text) ``` 确保将上述示例中的'image.jpg'替换为你要识别的图像路径。 希望这能帮到你!如果你有其他问题,请随时问我。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值