from PIL import Image
import pytesseract
import time
time1 = time.time()
img_path = 'C:/Users/Administrator/Desktop/ocr/109.png'
text = pytesseract.image_to_string(Image.open(img_path), lang='chi_sim')
time2 = time.time()
print(time2 - time1)
print(text)
python tesseract OCR
最新推荐文章于 2025-03-04 23:18:19 发布
本文介绍了一个使用Python的PyTesseract库进行中文OCR识别的例子。通过加载本地图片,利用PIL库打开图片,然后调用PyTesseract的image_to_string方法进行文字识别,最后输出识别时间和结果。这个例子展示了如何在Python环境中实现OCR识别,特别适用于中文文本的识别场景。
1707

被折叠的 条评论
为什么被折叠?



