diff --git a/Matlab/dip/lab3/PIC4.7.6a.bmp b/Matlab/dip/lab3/PIC4.7.6a.bmp new file mode 100644 index 0000000..bc62877 Binary files /dev/null and b/Matlab/dip/lab3/PIC4.7.6a.bmp differ diff --git a/Matlab/dip/lab3/eight.tif b/Matlab/dip/lab3/eight.tif new file mode 100644 index 0000000..d2d6cbd Binary files /dev/null and b/Matlab/dip/lab3/eight.tif differ diff --git a/Matlab/dip/lab3/lab3_1.m b/Matlab/dip/lab3/lab3_1.m new file mode 100644 index 0000000..e071639 --- /dev/null +++ b/Matlab/dip/lab3/lab3_1.m @@ -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); diff --git a/Matlab/dip/lab3/lab3_2.m b/Matlab/dip/lab3/lab3_2.m new file mode 100644 index 0000000..847ab90 --- /dev/null +++ b/Matlab/dip/lab3/lab3_2.m @@ -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)选择模板均值滤波'); diff --git a/Matlab/dip/lab3/lab4_3.m b/Matlab/dip/lab3/lab4_3.m new file mode 100644 index 0000000..0cfc1d2 --- /dev/null +++ b/Matlab/dip/lab3/lab4_3.m @@ -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)˹ģֵ˲'); diff --git a/Matlab/dip/lab3/lab4_4.m b/Matlab/dip/lab3/lab4_4.m new file mode 100644 index 0000000..67d6735 --- /dev/null +++ b/Matlab/dip/lab3/lab4_4.m @@ -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˲'); diff --git a/Matlab/dip/lab3/lab4_5.m b/Matlab/dip/lab3/lab4_5.m new file mode 100644 index 0000000..d70b818 --- /dev/null +++ b/Matlab/dip/lab3/lab4_5.m @@ -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ֵ˲ͼҶֵ'); diff --git a/Matlab/dip/lab3/lena.bmp b/Matlab/dip/lab3/lena.bmp new file mode 100644 index 0000000..2479f2c Binary files /dev/null and b/Matlab/dip/lab3/lena.bmp differ diff --git a/Matlab/dip/lab3/lena24b.bmp b/Matlab/dip/lab3/lena24b.bmp new file mode 100644 index 0000000..7d1d50a Binary files /dev/null and b/Matlab/dip/lab3/lena24b.bmp differ diff --git a/Matlab/dip/lab3/liftingbody.png b/Matlab/dip/lab3/liftingbody.png new file mode 100644 index 0000000..a5b1b89 Binary files /dev/null and b/Matlab/dip/lab3/liftingbody.png differ