python3 如何识别验证码png图片呢
PHP中文网
PHP中文网 2017-04-18 09:56:56
0
2
674

想打印png格式的验证码图片可是报错系统找不到指定文件;
更加打印不出来图片的文字;

存放图片的位置如图:

png图片为:

报错如图:

代码如下:

import pytesseract

from PIL import Image

image = Image.open(r'D:\image\image.png')

vcode = pytesseract.image_to_string(image)

print(vcode)


 
PHP中文网
PHP中文网

认证0级讲师

reply all(2)
刘奇

You probably haven’t installed Tesseract Ocr (To install the pytesseract library, you must first install the PIL and tesseract-ocr it depends on. PIL is an image processing library, and the latter tesseract-ocr is Google’s ocr recognition engine.)
Yes Refer to http://www.tuicool.com/articl...

I tried it, and the verification code with the difficulty as shown in the picture (very close and difficult to separate...blurred...) cannot be solved with these few lines of code (the recognition result is ". .").
This is what can be done

As for the picture below , if it’s not for learning image processing, don’t do it.

Ty80

This is not a verification code issue. This is a Windows problem.

Your system and tesseract should be 64-bit, while Python is 32-bit.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template