将上篇的代码稍加改动之后,对图像进行了基本的操作
__author__ = 'guoguo'
#encoding:utf-8
import scipy.misc
import matplotlib.pyplot
lena=scipy.misc.lena()
#drawing
matplotlib.pyplot.subplot(221)
matplotlib.pyplot.imshow(lena)
matplotlib.pyplot.subplot(222)
matplotlib.pyplot.imshow(lena[:,::-1])#沿纵轴翻转图像
matplotlib.pyplot.subplot(223)
matplotlib.pyplot.imshow(lena[:lena.shape[0]/2,:lena.shape[1]/2])#显示部分图像
mask=lena%2==0#创建掩模?不太理解
maskd_lena=lena.copy()
maskd_lena[mask]=0
matplotlib.pyplot.subplot(224)
matplotlib.pyplot.imshow(maskd_lena)
matplotlib.pyplot.show()
matplotlib.pyplot.subplot(224)
matplotlib.pyplot.imshow(aview)
matplotlib.pyplot.show()
其中lena[:,::-1]实现的是翻转
lena[:lena.shape[0]/2,:lena.shape[1]/2]实现的是图像的分割
掩模这一部分,和数字图像处理内容有关,并没有仔细研究