python计算机视觉编程-01
来源:互联网 发布:linux ping 编辑:程序博客网 时间:2024/04/30 10:09
1、安装PIL 库
http://blog.csdn.net/u014205968/article/details/39449275
2、需要额外安装libjpeg,否则在处理jpg图片会报错 'decoder jpeg not available '
MAC下执行如下命令即可
pip uninstall pillowbrew install libjpegpip install pillow
3、例子代码
(1) 绘制图像,点和线
#!/user/bin/env python# -*- coding: UTF-8 -*-from PIL import Imagefrom pylab import *#读取图像到数组im = array(Image.open('./image/1.jpg'))#绘制图像imshow(im)#一些点x = [100,100,400,400]y = [200,500,200,500]#使用红色星状标记绘制点plot(x,y,'r*')#绘制连接前两个点的线plot(x[:2],y[:2])#添加标题,显示绘制的图像title(u'python操作图像第一个例子')show()
(2) 图像轮廓和直方图
#!/user/bin/env python# -*- coding: UTF-8 -*-from PIL import Imagefrom pylab import *#读取图像到数组im = array(Image.open('./image/1.jpg').convert('L'))#新建一个图像figure()#不使用颜色信息gray()#在原点的左上角显示轮廓图像contour(im,origin = 'image')axis('equal')axis('off')figure()hist(im.flatten(),128)show()
(3) 交互式标注
#!/user/bin/env python# -*- coding: UTF-8 -*-from PIL import Imagefrom pylab import *im = array(Image.open('./image/1.jpg'))imshow(im)print 'Please click 3 points'x = ginput(3)print 'you clicked:',xshow()
0 0
- python计算机视觉编程-01
- 《Python计算机视觉编程》
- Python计算机视觉编程 笔记
- 推荐一个计算机视觉图书:python计算机视觉编程
- 推荐一个计算机视觉图书:python计算机视觉编程
- Python计算机视觉编程练习11:备忘
- 《python计算机视觉编程》读书笔记------1
- 《python计算机视觉编程》读书笔记------2
- OpenCV计算机视觉编程Python版
- Python计算机视觉编程练习1:Python 调用 SIFT
- python计算机视觉
- Python计算机视觉:安装
- Python计算机视觉编程练习2:import 自定义模块
- Python计算机视觉编程练习4:glob模块学习
- Python计算机视觉编程练习5:pickle模块学习
- Python计算机视觉编程练习6:文本、列表操作
- Python计算机视觉编程练习7:文件操作
- Python计算机视觉编程练习8:string 模块学习
- 持续交付学习笔记(一)
- 不同数据类型的相互转换
- [GVR]Google VR 工程导入
- Struts2入门示例教程
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- python计算机视觉编程-01
- 进制转换
- hdu1195 Open the Lock(bfs水题)
- 机器学习面试问题1
- 点击隐藏div存在iframe无效
- 回首往事----那年的自己
- Sprite和ImageView区别
- 人脸检测 coords 到屏幕 coords
- apk文件反编译