首页 > 技术文章 > 矩阵索引的使用——裁剪,颠倒

enden 2016-01-16 00:18 原文

%矩阵索引的作用
close all;clear all;clc
I=imread('rose.tif');
subplot(221),imshow(I),title('imshow(I)')

%行序号颠倒,上下颠倒
subplot(222),imshow(I(end:-1:1,:)),title('imshow(I(end:-1:1,:))')

%列序号颠倒,左右颠倒
subplot(223),imshow(I(:,end:-1:1)),title('imshow(I(:,end:-1:1))')

%裁剪
subplot(224),imshow(I(257:768,257:768)),title('imshow(I(257:768,257:768))')

%二次取样
figure,imshow(I(1:2:end,1:2:end));title('imshow(I(1:2:end,1:2:end))')

推荐阅读