问题描述

利用matlab完成10种变换效果即可,且在一个窗口中全部显示,并注明处理的效果名称;

导读

  • 实现代码
  • 效果截图

代码

I1=imread('d:\1.bmp');

%I = rgb2gray(RGB)
I=imread('d:\1.bmp');
I2= rgb2gray(I);

I = imread('d:\1.bmp');
tform = maketform('affine',[1 0 0; .5 1 0; 0 0 1]);
I3 = imtransform(I,tform);

I= imread('d:\1.bmp');
I4=im2bw(I);

I=imread('d:\1.bmp');
I5 = rgb2ind(I,128);

I=imread('d:\1.bmp');
I6(:,:,1)=I(:,:,1);
I6(:,:,2)=0;
I6(:,:,3)=0;

I7(:,:,2)=I(:,:,2);
I7(:,:,1)=0;
I7(:,:,3)=0;

I8(:,:,3)=I(:,:,3);
I8(:,:,1:2)=0;

A= imread('d:\1.bmp');
B=size(A);
for i=1:3
a0=[];
for j=1:B(1)
L=A(:,:,i);
H=[L(j,:);a0];
%H=[L(:,j),a0];
a0=H;
end
I9(:,:,i)=H;
end
figure

I=imread('d:\1.bmp');
J=double(I);
J=-J+(256-1);
I10=uint8(J);

I=imread('d:\1.bmp');
h=size(I);
I_fliplr(1:h(1),1:h(2),1:h(3))=I(1:h(1),h(2):-1:1,1:h(3));
I11=uint8(I_fliplr);

originalRGB = imread('d:\1.bmp');
h = fspecial('motion', 50, 45)
I12 = imfilter(originalRGB, h, 'replicate');

subplot(3,4,1),imshow(I1); title('原图像');
subplot(3,4,2),imshow(I2); title('灰度图像');
subplot(3,4,3),imshow(I3); title('旋转图像');
subplot(3,4,4),imshow(I4); title('二值图像');
subplot(3,4,5),imshow(I5); title('索引图像');
subplot(3,4,6),imshow(I6); title('红色道图像');
subplot(3,4,7),imshow(I7); title('绿色道图像');
subplot(3,4,8),imshow(I8); title('蓝色道图像');
subplot(3,4,9),imshow(I9); title('倒立图像');
subplot(3,4,10),imshow(I10);title('反转线性变换图像');
subplot(3,4,11),imshow(I11); title('水平镜像图像');
subplot(3,4,12),imshow(I12);title('凸显效果图像');

截图

 


Everything is alright