a=imread();
b=imread();
c=rgb2gray(a);
d=rgb2gray(b);
e=imresize(c,[198,198]);
f=imresize(d,[198,198]);
subplot(231);
imshow(e);
subplot(232);
g=imrotate(e,90);
imshow(g);
subplot(233);
imshow(f);
subplot(234);
h=imadd(e,f);
imshow(h);
subplot(235);
i=imsubtract(e,50);
imshow(i);
subplot(236);
j=mean(e);
stem(j);
pixval('on');
c=rgb2gray(a);
e=imresize(c,[198,198]);
imshow(e);
f=imresize(e,0.5);
imshow(f);
实验二(边缘检测)
a=imread();
b=rgb2gray(a);
c=imresize(b,[198,198]);
subplot(241);
imshow(c);
w=edge(c,'roberts');
x=edge(c,'prewitt');
y=edge(c,'sobel');
z=edge(c,'log');
subplot(242);
imshow(w);
subplot(243);
imshow(x);
subplot(244);
imshow(y);
subplot(245);
imshow(z);
subplot(246);
d=im2bw(c);
imshow(d);
subplot(247);
imhist(c);
figure;
实验三(图像增强)
a=imread();
b=rgb2gray(a);
c=imresize(b,[198,198]);
subplot(221);
imshow(c);
subplot(222);
d=imnoise(c,'gaussian');
imshow(d);
subplot(223);
h=1/2.*[0 1/4 0;1/4 1 1/4 ;0 1/4 0];
i=filter2(h,d);
imshow(i);
subplot(224);
j=medfilt2(d);
imshow(j);
高斯噪声
a=imread();
b=rgb2gray(a);
c=imresize(b,[225 225]);
subplot(221);
imshow(c);
subplot(222);
d=imnoise(c,'salt & pepper');%椒盐噪声
imshow(d);
subplot(223);
h=1/2.*[0 1/4 0;1/4 1 1/4 ;0 1/4 0];
i=filter2(h,d);
imshow(i,[]);
subplot(224);
j=medfilt2(d);
imshow(j);
椒盐噪声
实验四
a=imread();
subplot(221);
imshow(a);
subplot(222);
b=rgb2hsv(a);
imshow(b);
subplot(223);
c=rgb2ntsc(a);
imshow(c);
subplot(224);
d=rgb2ycbcr(a);
imshow(d);