码迷,mamicode.com
首页 > 编程语言 > 详细

python 验证码test

时间:2017-05-24 23:55:08      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:net   das   details   use   url   pip   chunk   pypi   转化   

灰度化

#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

python 验证码test

标签:net   das   details   use   url   pip   chunk   pypi   转化   

原文地址:http://www.cnblogs.com/crac/p/6901272.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!