📄 dip3.m
字号:
%2
i2=imread('Fig3.41(c).jpg');
i2=im2double(i2);
subplot(3,2,1);
imshow(i2);title('org img');
h1=[-1 -2 -1
0 0 0
1 2 1];
h2=[1 1 1
1 -8 1
1 1 1];
h3=[1 1 1
1 -9 1
1 1 1];
A=-1;
h4=[1 1 1
1 -A-8 1
1 1 1];
subplot(3,2,2);
g1=imfilter(i2,h1);
g1=imadd(i2,g1);
imshow(g1);title('g1');
subplot(3,2,3);
g2=imfilter(i2,h2);
g2=imadd(i2,g2);
imshow(g2);title('g2');
subplot(3,2,4);
g3=imfilter(i2,h3);
g3=imadd(i2,g3);
imshow(g3);title('g3');
subplot(3,2,5);
g4=imfilter(i2,h4);
g4=imadd(i2,g4);
imshow(g4);title('g4');
%5
i5=imread('Fig3.46(a).jpg');
i5=im2double(i5);
subplot(3,2,6);
imshow(i5);title('5 org img');
%51
figure;
subplot(3,2,1);
g51=imfilter(i5,h2);
imshow(g51);title('51');
%52
subplot(3,2,2);
i52=imadd(i5,g51);
imshow(i52);title('52');
subplot(3,2,3);
h52 = fspecial('average',[3 3]); %生成一3×3邻域平均窗函数
g52 = filter2(h52,i51); %求邻域平均
imshow(g52);title('g52');
%53
subplot(3,2,4);
H = fspecial('sobel');
SOBEL=imfilter(i5,H);
i53=imadd(i5,SOBEL);
imshow(i53);title('53');
subplot(3,2,5);
H = fspecial('average',[5 5]); %生成一5×5邻域平均窗函数
g53=filter2(H,i53); %求邻域平均
imshow(g53);title('g53');
%54
subplot(3,2,6);
i54l=immultiply(i52,i52);
imshow(i54);title('54l');
figure;
subplot(3,2,1);
i54s=immultiply(i53,i53);
imshow(i54);title('54s');
%55
subplot(3,2,2);
i55l=imadjust(i52,[],[],0.2);
imshow(i55l);title('55l');
subplot(3,2,3);
i55=imadjust(i54l,[],[],0.1);
imshow(i55);title('g55l');
subplot(3,2,4);
i55s=imadjust(i53,[],[],0.1);
imshow(i55s);title('55s');
subplot(3,2,5);
g55=imadjust(i54s,[],[],0.1);
imshow(g55);title('g55s');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -