Python Imaging LibraryHandbookhttp://effbot.org/imagingbook/pil-index.htm随机验证码的产生 1 import Image, ImageDraw, ImageFont, ImageFilter 2 import random 3 ...
分类:
其他好文 时间:
2015-11-04 14:34:50
阅读次数:
578
读取部分结果程序# -*- coding: utf-8 -*-import numpy as np import matplotlib.pyplot as pltfrom PIL import Imagedef ImagetoData(num=100): filename = 'face/fa...
分类:
编程语言 时间:
2015-11-01 11:19:24
阅读次数:
521
程序# coding=gbkfrom PIL import Imageimport numpy as np# import scipyimport matplotlib.pyplot as pltdef ImageToMatrix(filename): # 读取图片 im = Image...
分类:
编程语言 时间:
2015-11-01 11:19:16
阅读次数:
254
# coding=gbkfrom PIL import Imageimport numpy as np# import scipydef loadImage(): # 读取图片 im = Image.open("lena.jpg") # 显示图片 im.show() ...
分类:
编程语言 时间:
2015-10-31 11:34:29
阅读次数:
1144
验证码生成依赖于PIL库。生成验证码的代码如下:def captcha(request): width = 100 height = 40 bg_color = (255, 255, 255) image = Image.new('RGB', (width, height),...
分类:
其他好文 时间:
2015-10-29 13:01:04
阅读次数:
295
//数据挖掘&机器学习实践1.简单的手写数字识别原理:可以先通过多次手写的图片生成训练集,然后利用knn就行了……代码如下(下面代码需要安装PIL/numpy库,PIL安装有点坑==官方的貌似还有点问题。。。) 1 //knn.py 2 from numpy import * 3 import...
分类:
其他好文 时间:
2015-10-22 14:09:20
阅读次数:
437
图像处理经常需要提取图片的ROI,本文使用Python提取图片的ROI。使用的Module是PIL (Pillow),一个图像处理库,用到的函数为类 Image 中的 crop 方法。函数原型为:Image.crop(box=None)Returns a rectangular region fro...
分类:
编程语言 时间:
2015-10-22 09:15:12
阅读次数:
3016
贪心+网络流。对于每个结点,构建入点和出点。对于每一个lizard>0,构建边s->in position of lizard, 容量为1.对于pillar>0, 构建边in position of pillar -> out position of pillar, 容量为number of pil...
今天测试的时候,发现报没有PIL的错误,敲入 pip install PIL 并没有成功,看到许多博客说敲入这个命令成功的也有可能在运行中遇到别的问题,所以还是自己安装比较靠谱。1、下载wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz2、解压...
分类:
编程语言 时间:
2015-10-10 16:59:16
阅读次数:
352
# -*- coding: utf-8 -*-"""Created on Sun Oct 4 15:57:46 2015@author: keithguofan"""import randomfrom PIL import Image,ImageDraw,ImageFontimport math,....
分类:
编程语言 时间:
2015-10-05 11:40:09
阅读次数:
149