关键词:
今天学了下python的OCR识别,其中遇到好多坑,下面就一一阐述是如何破解的,本人用的是Windows 64位,IDE是VS2017。
- pip版本过低。
首先安装pytesseract这个库,pip install tessract。由于自己输错了,tessract前少了py两个字母,安装没有成功,抛出一个pip版本过低的问题,我就将pip升级到最新版9.0.3,以前是9.0.1。
输入python -m pip install --upgrade pip后提示没有访问权限,这里我就用管理员模式进到python目录下更新,这样就成功了。
- 找不到指定文件
在安装完pytessract后,还要去官网下载一个Tessract.exe文件安装配合使用。
出现这个错误,想了一会儿没找到原因,搜了一下有说把要识别的图片放到pytessract的安装库下,试了一下没成功,而且个人认为这不是问题所在,因为把Image.open()的路径已经指定了也不行。
另一个方法是:
pytesseract.pytesseract.tesseract_cmd = r‘C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\Tesseract-OCR\\tesseract‘
试了一下,成功了。仔细一想瞬间就明白了:官方给的是pytessract和Tessract.exe配合使用(Windows系统下),那么IDE怎么知道你这个CMD在哪个文件下,所以在使用时要手动声明你的pytessract需要哪个CMD来执行识别的工作,文件路径就是你Tessract的安装路径里tessract.exe的路径。
最后说一点,Tessract这个识别率不高,4个字符识别出2个,还错一个。
如何在 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 读取低分辨率图像
】使用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我拍摄一帧并将它... 查看详情
使用 pytesseract 提高结果时如何设置配置 load_system_dawg?
】使用pytesseract提高结果时如何设置配置load_system_dawg?【英文标题】:Howtosetconfigload_system_dawgwhenusingpytesseracttoimproveresult?【发布时间】:2019-12-1814:48:11【问题描述】:我正在尝试通过使用pytesseract配置更改参数来改善结果。我想... 查看详情
将 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应用于图像后在列表中生... 查看详情