python 验证码test

灰度化

#coding:utf8
import re
import urllib
import urllib2
import requests
from PIL import Image
import numpy as np def downloads_pic(**kwargs):
pic_name = kwargs.get('pic_name', None) url = 'http://www.xxx.com/code.do'
res = requests.get(url, stream=True)
with open(pic_path +'test11.bmp', 'wb') as f:
for chunk in res.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
f.flush()
f.close()
pic_path='tmp\\' downloads_pic()
image = Image.open('tmp\\test.bmp')
#image.show() #显示图片
imgry = image.convert('L') # 转化为灰度图 1:背景黑白

from PIL import Image
import numpy as np

install numpy

https://pypi.python.org/packages/2c/93/9556d25b1f23fd852fc2ddfcf68a4a62ba9e4ef83adabbf8921c80fce9a0/numpy-1.11.3-cp27-none-win_amd64.whl#md5=33bfb4c5f5608d3966a6600fa3d7623c

python -m pip install --upgrade pip

pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose


Mark

http://www.cnblogs.com/yinxiangnan-charles/p/5928689.html

http://www.cnblogs.com/beer/p/5672678.html

http://blog.csdn.net/qq_30490125/article/details/51445390

上一篇:LaTeX常用数学符号表示方法


下一篇:MySQL Binlog 介绍