安装软件:
pip install cv
pip install paddlepaddle
pip install pandas -i https://pypi.douban.com/simple
pip install paddleocr==2.6.0.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install paddleocr
paddleocr-2.7.0.3-py3-none-any.whl
代码: pic2Excel.py
import os
import cv2
import pandas as pd
from paddleocr import PPStructure,save_structure_res
table_engine = PPStructure(layout=False, show_log=True)
save_folder = './output'
img_path = '1.jpg'
img = cv2.imread(img_path)
result = table_engine(img)
save_structure_res(result, save_folder, os.path.basename(img_path).split('.')[0])
执行代码:
python pic2Excel.py