惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - 马维拉的真实之眼

关于win7添加惠普打印机驱动出现网络打印机驱动安装失败问题的各种解决方法 python 与C#的类方面的区别,纯属感受 word的临时文件机制,还挺有趣 LeetCode,3. 无重复字符的最长子串 LeetCode的一道题引申的python实现的对字符串进行分词,提取词频的方法 python+lego ev3的心得总结 随时更新 坎巴拉太空计划的心得总结 最近学习的sql查询语句连接查询,标记一下 zt <Windows Image Acquisition (WIA)> from msdn zt对于C#中的FileUpload解决文件上传大小限制的问题设置 当不搞技术好几年后,又回来了,忽然很亲切 胡亥语录,也应该学习学习 无意中看到了一个wii Remote的新应用,廉价触摸屏,很实用,而且已经有人在用了,淘宝上已经有卖红外线笔的了 准备入手wii,先在网上乱看了几小时,然后看到了一条新闻,说360和ps3也要做体感,然后就看到了这两张360的体感游戏照片,太牛叉了 这两天要给别人做视频,学习了下友立的会声会影,找到了些好资源 晕,我的nokia 3500c 和 数独游戏 内存惊魂 EA:这不是一个BUG(只有EA这么财大气粗的才能玩这么NB的招数) 谭望嵩和郑智
解决ecplise+phthon2.7中使用pytesser和tesseract进行ocr,出现报错的问题
马维拉的真实之眼 · 2018-02-06 · via 博客园 - 马维拉的真实之眼

网上很多使用ecplise+phthon2.7中使用pytesser或者tesseract进行OCR网站验证码的案例,但配置起来实在让人崩溃。

通用步骤:
1、下载了pytesser_v0.0.1;

2、然后解压后拷贝到C:\ProgramData\Anaconda2\Lib\site-packages;

3、文件夹名字改为pytesser;

4、然后在C:\ProgramData\Anaconda2\Lib\site-packages文件夹下新建一个文件,起名为pytesser.pth,内容为pytesser

5、然后在C:\ProgramData\Anaconda2\Lib\site-packages\pytesser\pytesser.py文件中第六行,更改import Image  为 from PIL import Image;

6、然后在ecplice界面中写代码:

from PIL import Image    
from pytesser import * im = Image.open('C:\\ProgramData\\Anaconda2\\Lib\\site-packages\\pytesser\\phototest.tif')
im.show()

没问题,图片顺利的打开了。

7、然后调用了下oCR的函数:

print image_to_string(im)

然后就无穷无尽的报错。

ecplice的错误提示还毫无帮助,只提示:

Traceback (most recent call last):
  File "C:\Users\TF-2016\Desktop\spider\ruijie\ruijie.py", line 33, in <module>
    print image_file_to_string('11.png', graceful_errors=True)
  File "C:\Python27\lib\site-packages\pytesser\pytesser.py", line 48, in image_file_to_string
    call_tesseract(filename, scratch_text_name_root)
  File "C:\Python27\lib\site-packages\pytesser\pytesser.py", line 23, in call_tesseract
    proc = subprocess.Popen(args)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] 

网上找了两个小时,很多人遇到这个问题,几乎没有解决的,最后发现有人说起了:http://blog.csdn.net/c465869935/article/details/51438576

然后我决定下载一个最新版的tesseract 3.0.2版,不再依靠pytesseract自带的那个1.01版本了。

下载后安装,然后在pytesseract.py中把tesseract_exe_name = 'tesseract' # Name of executable to be called at command line  改为:

tesseract_exe_name = r'C:/Program Files (x86)/Tesseract-OCR/tesseract.exe' #  'tesseract' Name of executable to be called at command line

然后运行,ok了,可以ocr英文和数字了。

但遗憾的是,中文库是谷歌的网址,下载不下来,如果能下载下来,很期待ocr中文的效果。