feat(matlab) dip lab 3 half
This commit is contained in:
parent
5fd8752550
commit
4b95af4cee
10 changed files with 127 additions and 0 deletions
BIN
Matlab/dip/lab3/PIC4.7.6a.bmp
Normal file
BIN
Matlab/dip/lab3/PIC4.7.6a.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
Matlab/dip/lab3/eight.tif
Normal file
BIN
Matlab/dip/lab3/eight.tif
Normal file
Binary file not shown.
17
Matlab/dip/lab3/lab3_1.m
Normal file
17
Matlab/dip/lab3/lab3_1.m
Normal 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
30
Matlab/dip/lab3/lab3_2.m
Normal 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
34
Matlab/dip/lab3/lab4_3.m
Normal 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
22
Matlab/dip/lab3/lab4_4.m
Normal 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
24
Matlab/dip/lab3/lab4_5.m
Normal 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
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
BIN
Matlab/dip/lab3/lena24b.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
BIN
Matlab/dip/lab3/liftingbody.png
Normal file
BIN
Matlab/dip/lab3/liftingbody.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
Reference in a new issue