feat(matlab) dip lab 3 half

This commit is contained in:
iridiumR 2022-11-21 11:42:00 +08:00
parent 5fd8752550
commit 4b95af4cee
10 changed files with 127 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Matlab/dip/lab3/eight.tif Normal file

Binary file not shown.

17
Matlab/dip/lab3/lab3_1.m Normal file
View file

@ -0,0 +1,17 @@
close all
clear
clc
disp('====E4_7_1.m====');
I=[0 20 40 70
80 100 120 150
160 180 200 230]
uint8I=uint8(I)
subplot(2,2,1),imshow(uint8I),ylabel('');
subplot(2,2,2),imhist(uint8I);
mask = fspecial('average',5) % 1
J=filter2(mask,uint8I)
uint8J=uint8(J)
subplot(2,2,3),imshow(uint8J),ylabel('3*3');
subplot(2,2,4),imhist(uint8J);

30
Matlab/dip/lab3/lab3_2.m Normal file
View file

@ -0,0 +1,30 @@
close all
clear
clc
disp('====E4_7_3.m====');
I=imread('PIC4.7.6a.bmp');
subplot(2,3,1),imshow(I),xlabel('(a)'),ylabel('');
K1=filter2(fspecial('average',3),I);
subplot(2,3,2),imshow(uint8(K1)),xlabel('(b)3*3');
mask=[0 0 0
0 1 1
0 1 1];
mask=(1/4)*mask;
K2=filter2(mask,I);
subplot(2,3,3),imshow(uint8(K2)),xlabel('(c)');
J=imnoise(I,'salt & pepper',0.4); % 1
subplot(2,3,4),imshow(J),xlabel('(a)'),ylabel('');
K3=filter2(fspecial('average',3),J);
subplot(2,3,5),imshow(uint8(K3)),xlabel('(b)3*3');
mask=[0 0 0
0 1 1
0 1 1];
mask=(1/4)*mask;
K4=filter2(mask,J);
subplot(2,3,6),imshow(uint8(K4)),xlabel('(c)');

34
Matlab/dip/lab3/lab4_3.m Normal file
View file

@ -0,0 +1,34 @@
close all
clear
clc
disp('====E4_7_4.m====');
I=imread('liftingbody.png');
subplot(2,3,1),imshow(I),xlabel('(a)');
J=imnoise(I,'salt & pepper',0.06);
subplot(2,3,2),imshow(J),xlabel('(b)');
K1=filter2(fspecial('average',3),J);
subplot(2,3,3),imshow(uint8(K1)),xlabel('(c)3*3');
mask1=[0 1 0
1 0 1
0 1 0];
mask1=(1/2)*mask1; % 1
K2=filter2(mask1,J);
subplot(2,3,4),imshow(uint8(K2)),xlabel('(d)4');
mask2=[1 1 1
1 0 1
1 1 1];
mask2=(1/16)*mask2; % 2
K3=filter2(mask2,J);
subplot(2,3,5),imshow(uint8(K3)),xlabel('(e)8');
mask3=[1 2 1
2 4 2
1 2 1];
mask3=(1/16)*mask3;
K4=filter2(mask3,J);
subplot(2,3,6),imshow(uint8(K4)),xlabel('(f)');

22
Matlab/dip/lab3/lab4_4.m Normal file
View file

@ -0,0 +1,22 @@
close all
clear
clc
disp('====E4_7_5.m====');
I=imread('eight.tif');
subplot(2,3,1),imshow(I),xlabel('(a)ԭʼͼÏñ');
J=imnoise(I,'salt & pepper',0.4); % Óï¾ä1
subplot(2,3,2),imshow(J),xlabel('(b)ÔëÉùͼÏñ');
K1=wiener2(J,[3,3]);
subplot(2,3,3),imshow(uint8(K1)),xlabel('(c)3*3WienerÂ˲¨');
K2=wiener2(J,[5,5]);
subplot(2,3,4),imshow(uint8(K2)),xlabel('(d)5*5WienerÂ˲¨');
K3=wiener2(J,[7,7]);
subplot(2,3,5),imshow(uint8(K3)),xlabel('(e)7*7WienerÂ˲¨');
K4=wiener2(J,[9,9]);
subplot(2,3,6),imshow(uint8(K4)),xlabel('(f)9*9WienerÂ˲¨');

24
Matlab/dip/lab3/lab4_5.m Normal file
View file

@ -0,0 +1,24 @@
close all
clear
clc
disp('====E4_8_1.m====');
I1=[0 0 0 240 80 100 240 0 0 0]
uint8I1=uint8(I1);
subplot(2,4,1),imshow(uint8I1),xlabel('(a-1)(l=4)');
subplot(2,4,2),plot(I1,'.-'),axis([0 11 0 250]),xlabel('(a-2)');
J1=medfilt2(uint8I1,[1,3]) % 1
uint8J1=uint8(J1);
subplot(2,4,3),imshow(uint8J1),xlabel('(b-1)1-D(r=3)');
subplot(2,4,4),plot(J1,'.-'),axis([0 11 0 250]),xlabel('(b-2)1-D');
J2=medfilt2(uint8I1,[1,9])
uint8J2=uint8(J2);
subplot(2,4,5),imshow(uint8J2),xlabel('(c-1)1-D(r=4)');
subplot(2,4,6),plot(J2,'.-'),axis([0 11 0 250]),xlabel('(c-2)1-D');
J3=medfilt2(uint8I1,[1,11])
uint8J3=uint8(J3);
subplot(2,4,7),imshow(uint8J3),xlabel('(d-1)1-D(r=5)');
subplot(2,4,8),plot(J3,'.-'),axis([0 11 0 250]),xlabel('(d-2)1-D');

BIN
Matlab/dip/lab3/lena.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
Matlab/dip/lab3/lena24b.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB