翻转图像以及创建掩模

将上篇的代码稍加改动之后,对图像进行了基本的操作

__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]实现的是图像的分割
掩模这一部分,和数字图像处理内容有关,并没有仔细研究

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值