使用pytesseract+tesseract-ocr识别图片的简单步骤(代码片段)

yaoczz yaoczz     2022-12-03     353

关键词:

1.首先安装Pytesseract,这个很简单,直接输入命令 pip install pytesseract即可

技术图片

2.Tesseract-OCR https://pan.baidu.com/s/1sVYyKcPclZxWfFJDjy471g 提取码:5ib2 这个我也是在网上找到,可以直接下载使用

下载好后去修改pytesseract.py中的内容如下图

技术图片

3.pycharm中验证是否成功,注意:这里的图片是相对路径,我放到了pycharm里面

from PIL import Image
import pytesseract
image = pytesseract.image_to_string(Image.open("1.png"))
print(image)
看到下图识别成功,这个识别率不是很高,网上还有很多的方法,需要慢慢研究改正。

技术图片

 


 


 

如何在 pytesseract 中使用经过训练的数据?

】如何在pytesseract中使用经过训练的数据?【英文标题】:Howtousetraineddatawithpytesseract?【发布时间】:2017-10-2606:59:31【问题描述】:使用此工具http://trainyourtesseract.com/我希望能够在pytesseract中使用新字体。该工具给了我一个名为*.t... 查看详情

pytesseract库的安装和使用

...怎么解析图片上的信息呢?在Google上查了一下,需要安装pytesseract和pillow(我用的python3.7)和Tesseract-OCR1.安装pytesseract  pipinsatllpytesseract2.安装pillow  pipinstallpillow3.安装Tesseract-OCR(https://githu 查看详情

如何使用 Pytesseract 文本识别改进 OCR?

】如何使用Pytesseract文本识别改进OCR?【英文标题】:HowtoimproveOCRwithPytesseracttextrecognition?【发布时间】:2020-06-2217:28:25【问题描述】:您好,我希望使用pytesseract提高我在数字识别方面的表现。我将原始图像分割成如下所示的部... 查看详情

pytesseract的使用|python识别验证码(代码片段)

目录1.安装tesseract2.安装pytesseract3.修改包中部分代码4.代码网站测试1.安装tesseract详见:https://blog.csdn.net/lijiamingccc/article/details/1194597752.安装pytesseract在pycharm终端下,安装pytesseract,如图所示pipinstall 查看详情

如何使用 pytesseract 从图像中检测数字?

】如何使用pytesseract从图像中检测数字?【英文标题】:Howtodetectdigitsfromimagesusingpytesseract?【发布时间】:2021-08-0610:09:37【问题描述】:我正在尝试从图像中检测文本但由于某些未知原因而失败。importpytesseractasptfromPILimportImageimpor... 查看详情

是否可以使用 pytesseract 从图像的特定部分提取文本

】是否可以使用pytesseract从图像的特定部分提取文本【英文标题】:Isitpossibletoextracttextfromspecificportionofimageusingpytesseract【发布时间】:2020-03-1520:12:40【问题描述】:我在图像中有边界框(矩形坐标),并希望在该坐标内提取文本... 查看详情

使用 PIL 从 url 打开图像文件以使用 pytesseract 进行文本识别

】使用PIL从url打开图像文件以使用pytesseract进行文本识别【英文标题】:OpeningImagefilefromurlwithPILfortextrecognitionwithpytesseract【发布时间】:2017-09-1005:09:06【问题描述】:我在尝试下载图像并使用BytesIO打开它以便使用PIL和pytesseract从... 查看详情

使用 Python3 Pytesseract 进行实时屏幕监控

】使用Python3Pytesseract进行实时屏幕监控【英文标题】:LiveScreenMonitoringWithPython3Pytesseract【发布时间】:2019-07-1416:05:00【问题描述】:我正在Windows10上开发一个python3项目,我想知道是否有人知道通过pytesseract传递opencv屏幕抓取?如... 查看详情

我对 pytesseract 有疑问

】我对pytesseract有疑问【英文标题】:Ihaveissueswithpytesseract【发布时间】:2020-12-3001:50:23【问题描述】:我有一个使用pytesseract的项目。我安装了tesseract,但每次尝试运行代码时都会出现此错误。pytesseract.pytesseract.TesseractError:(1,\'E... 查看详情

pytesseract使用的坑

...本人用的是Windows64位,IDE是VS2017。pip版本过低。首先安装pytesseract这个库,pipinstalltessract。由于自己输错了,tessract前少了py两个字母,安装没有成功,抛出一个pip版本过低的问题,我就将pip升级到最新版9.0.3,以前是9.0.1。输入py... 查看详情

使用 pytesseract 读取低分辨率图像

】使用pytesseract读取低分辨率图像【英文标题】:Readinglowresolutionimagewithpytesseract【发布时间】:2019-04-2611:50:05【问题描述】:我正在尝试从pdf文件中表格的裁剪(手动)部分读取一些统计信息。HereistheimageI\'mtryingtoprocess我得到的... 查看详情

使用pytesseract识别简单验证码

fromPILimportImageimportpytesseractfrompytesseractimport*rep={‘O‘:‘0‘,#替换列表‘I‘:‘1‘,‘L‘:‘1‘,‘Z‘:‘2‘,‘S‘:‘8‘};definitTable(threshold=140):#二值化函数table=[]foriinrange(256):ifi<threshold:table.append(0)e 查看详情

PyTesseract - 将 OCR 限制为一组字符

】PyTesseract-将OCR限制为一组字符【英文标题】:PyTesseract-RestrictingOCRtoasetofcharacters【发布时间】:2017-06-2419:27:25【问题描述】:我在使用pytesseract时遇到问题。我知道您可以使用命令行参数将tesseract限制为一组特定的字符:tesserac... 查看详情

Pytesseract:FileNotFound

】Pytesseract:FileNotFound【英文标题】:Pytesseract:FileNotFound【发布时间】:2017-11-0614:35:33【问题描述】:我在使用Pytesser进行测试时遇到了一些问题:fromPILimportImageimportpytesseractimg=Image.open(\'pic.png\')img.load()text=pytesseract.image_to_string(im 查看详情

使用自定义字体的 Pytesseract 错误地对数字进行分类

】使用自定义字体的Pytesseract错误地对数字进行分类【英文标题】:Pytesseractwithcustomfontincorrectlyclassifyingnumbers【发布时间】:2020-05-2608:24:18【问题描述】:我正在尝试使用pytesseract检测价格。但是我的结果很糟糕。我有一张大图... 查看详情

如何使用 PyTesseract 去除图像噪声以改善结果?

】如何使用PyTesseract去除图像噪声以改善结果?【英文标题】:HowtogetridofimagenoiseforimprovingresultswithPyTesseract?【发布时间】:2020-09-0305:54:19【问题描述】:我正在尝试从视频的左上角获取文本“P1”和“P2”。P1P2我拍摄一帧并将它... 查看详情

将 image_to_osd 方法与 pytesseract 一起使用时出错

】将image_to_osd方法与pytesseract一起使用时出错【英文标题】:Gettinganerrorwhenusingtheimage_to_osdmethodwithpytesseract【发布时间】:2019-05-3112:11:39【问题描述】:这是我的代码:importpytesseractimportcv2fromPILimportImagepytesseract.pytesseract.tesseract_cm 查看详情

与多处理一起使用时,PyTesseract 调用工作非常缓慢

】与多处理一起使用时,PyTesseract调用工作非常缓慢【英文标题】:PyTesseractcallworkingveryslowwhenusedalongwithmultiprocessing【发布时间】:2019-04-2708:24:42【问题描述】:我有一个函数,它接收图像列表并在将OCR应用于图像后在列表中生... 查看详情