Python与图像处理(1):绘制图像,点和线,图像轮廓,直方图
2016-06-26 21:30
791 查看
说明:此实验主要是在Python中实现:绘制图像,点和线,图像轮廓,直方图
实验结果
参考图书《Python计算机视觉》
import tkFileDialog from PIL import Image from pylab import * #打开一个对话框用来选择一个文件 filename = tkFileDialog.askopenfilename(initialdir='E:\experimentcode\Python\stripenoise') #读入图片 im = Image.open(filename) #读取图像到数组中 imA = array(im) #绘制图像 imshow(imA) #绘制一些点 x = [100,100,400,400] y = [200,500,200,500] plot(x,y,'r*') plot(x[:2],y[:2]) title('Plotting:"sea.jpg"') imB = array(im.convert('L')) #新建一个图像 figure() #不使用图像信息 gray() #在原点的左上角显示轮廓图像 contour(imB, origin='image') axis('equal') axis('off') figure() hist(imB.flatten(),128) show()
实验结果
参考图书《Python计算机视觉》
相关文章推荐
- python编程结构(编写ArcGIS中的工具)--以我的第一个程序为例
- python中的enumerate函数的用法
- 6.2 Python构造C数据类型
- 10W-python
- python 实现树结构的打印
- python 实现有定义域的函数,可用来做类型测试
- python BeautifulSoup获取 网页链接的文字内容
- python BeautifulSoup获取网页正文
- Python List find方法报错 TypeError: 'str' does not support the buffer interface
- python 串口效率测试
- Python 文件I/O
- 通过vscode执行python程序
- 谨慎修改Python的类属性
- link to python 3
- python两个dataframe的合并
- pycharm2016.1.4专业版破解码
- python 金字塔图形
- Python菜鸟之路:Python基础-类(2)——成员、成员修饰符、异常及其他
- Python学习(4)
- chardet demo