diff --git a/Matlab/dip/lab2/A.bmp b/Matlab/dip/lab2/A.bmp new file mode 100644 index 0000000..d51a8a5 Binary files /dev/null and b/Matlab/dip/lab2/A.bmp differ diff --git a/Matlab/dip/lab2/B.bmp b/Matlab/dip/lab2/B.bmp new file mode 100644 index 0000000..ea574ef Binary files /dev/null and b/Matlab/dip/lab2/B.bmp differ diff --git a/Matlab/dip/lab2/lab2_1.m b/Matlab/dip/lab2/lab2_1.m new file mode 100644 index 0000000..0c3ad1b --- /dev/null +++ b/Matlab/dip/lab2/lab2_1.m @@ -0,0 +1,20 @@ +close all +clear +clc +disp('====E4_3_1a.m===='); + +X=uint8([255 0 75 + 44 255 100]) +Y=uint8([50 50 50 + 50 50 50]) +Z=imadd(X,Y) + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=rgb2gray(I1); +I4=rgb2gray(I2); +I5=imadd(I3,I4); % Óï¾ä1 + +subplot(1,3,1),imshow(I3),xlabel('A'); +subplot(1,3,2),imshow(I4),xlabel('B'); +subplot(1,3,3),imshow(I5),xlabel('A+B'); diff --git a/Matlab/dip/lab2/lab2_2.m b/Matlab/dip/lab2/lab2_2.m new file mode 100644 index 0000000..2a11706 --- /dev/null +++ b/Matlab/dip/lab2/lab2_2.m @@ -0,0 +1,20 @@ +close all +clear +clc +disp('====E4_3_4.m===='); + +X=uint8([255 0 75 + 44 255 100]) +Y=uint8([50 50 50 + 50 50 50]) +Z=imsubtract(X,Y) + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=rgb2gray(I1); +I4=rgb2gray(I2); +I5=imsubtract(I3,I4); + +subplot(1,3,1),imshow(I3),xlabel('A'); +subplot(1,3,2),imshow(I4),xlabel('B'); +subplot(1,3,3),imshow(I5),xlabel('A-B'); diff --git a/Matlab/dip/lab2/lab2_3.m b/Matlab/dip/lab2/lab2_3.m new file mode 100644 index 0000000..c9f0d7e --- /dev/null +++ b/Matlab/dip/lab2/lab2_3.m @@ -0,0 +1,20 @@ +close all +clear +clc +disp('====E4_3_7.m===='); + +X=uint8([50 50 50 + 50 50 50]) +Y=uint8([1 2 3 + 4 5 6]) +Z=immultiply(X,Y) + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=rgb2gray(I1); +I4=rgb2gray(I2); +I5=immultiply(I3,I4); + +subplot(1,3,1),imshow(I3),xlabel('A'); +subplot(1,3,2),imshow(I4),xlabel('B'); +subplot(1,3,3),imshow(I5),xlabel('A*B'); diff --git a/Matlab/dip/lab2/lab2_4.m b/Matlab/dip/lab2/lab2_4.m new file mode 100644 index 0000000..37b2417 --- /dev/null +++ b/Matlab/dip/lab2/lab2_4.m @@ -0,0 +1,26 @@ +close all +clear +clc +disp('====E4_3_10.m===='); + +X=uint8([0 0 50 + 50 50 50]) +Y=uint8([0 1 0 + 2 3 4]) +Z=imdivide(X,Y) + +I1=imread('A.bmp'); +I2=imread('B.bmp'); + +I3=rgb2gray(I1); +I4=rgb2gray(I2); +I5=imdivide(I3,I4); + +I6=im2bw(I1); +I7=im2bw(I2); +I8=imdivide(I6,I7); + +subplot(1,4,1),imshow(I3),xlabel('(a)ͼA'); +subplot(1,4,2),imshow(I4),xlabel('(b)ͼB'); +subplot(1,4,3),imshow(I5),xlabel('(c)»Ò¶ÈͼÏóA/B'); +subplot(1,4,4),imshow(I8),xlabel('(d)¶þֵͼÏñA/B'); diff --git a/Matlab/dip/lab2/lab2_5.m b/Matlab/dip/lab2/lab2_5.m new file mode 100644 index 0000000..ee215ac --- /dev/null +++ b/Matlab/dip/lab2/lab2_5.m @@ -0,0 +1,20 @@ +close all +clear +clc +disp('====E4_3_14.m===='); + +X=uint8([0 0 1 1 + 0 0 2 3]) +Y=uint8([0 1 0 1 + 0 2 0 3]) +Z=X&Y + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=im2bw(I1); +I4=im2bw(I2); +I5=I3&I4; % Óï¾ä1 + +subplot(1,3,1),imshow(I3),xlabel('(a)A'); +subplot(1,3,2),imshow(I4),xlabel('(b)B'); +subplot(1,3,3),imshow(I5),xlabel('(c)A AND B'); diff --git a/Matlab/dip/lab2/lab2_6.m b/Matlab/dip/lab2/lab2_6.m new file mode 100644 index 0000000..c8c10d9 --- /dev/null +++ b/Matlab/dip/lab2/lab2_6.m @@ -0,0 +1,20 @@ +close all +clear +clc +disp('====E4_3_15.m===='); + +X=uint8([0 0 1 1 + 0 0 2 3]) +Y=uint8([0 1 0 1 + 0 2 0 3]) +Z=X|Y + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=im2bw(I1); +I4=im2bw(I2); +I5=I3|I4; + +subplot(1,3,1),imshow(I3),xlabel('£¨a£©A'); +subplot(1,3,2),imshow(I4),xlabel('£¨b£©B'); +subplot(1,3,3),imshow(I5),xlabel('£¨c£©A OR B'); diff --git a/Matlab/dip/lab2/lab2_7.m b/Matlab/dip/lab2/lab2_7.m new file mode 100644 index 0000000..9fa8752 --- /dev/null +++ b/Matlab/dip/lab2/lab2_7.m @@ -0,0 +1,19 @@ +close all +clear +clc +disp('====E4_3_16.m===='); + +X=uint8([0 1 2 3]) +Y=~X + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=im2bw(I1); +I4=~I3; +I5=im2bw(I2); +I6=~I5; + +subplot(1,4,1),imshow(I3),xlabel('£¨a£©A'); +subplot(1,4,2),imshow(I4),xlabel('£¨b£©NOT A'); +subplot(1,4,3),imshow(I5),xlabel('£¨c£©B'); +subplot(1,4,4),imshow(I6),xlabel('£¨d£©NOT B'); diff --git a/Matlab/dip/lab2/lab2_8.m b/Matlab/dip/lab2/lab2_8.m new file mode 100644 index 0000000..4fc4d5c --- /dev/null +++ b/Matlab/dip/lab2/lab2_8.m @@ -0,0 +1,20 @@ +close all +clear +clc +disp('====E4_2_17.m===='); + +X=uint8([0 0 1 1 + 0 0 2 3]) +Y=uint8([0 1 0 1 + 0 2 0 3]) +Z=xor(X,Y) + +I1=imread('A.bmp'); +I2=imread('B.bmp'); +I3=im2bw(I1); +I4=im2bw(I2); +I5=xor(I3,I4); + +subplot(1,3,1),imshow(I3),xlabel('£¨a£©A'); +subplot(1,3,2),imshow(I4),xlabel('£¨b£©B'); +subplot(1,3,3),imshow(I5),xlabel('£¨c£©A XOR B'); diff --git a/Matlab/dip/lab2/rice.png b/Matlab/dip/lab2/rice.png new file mode 100644 index 0000000..8e17898 Binary files /dev/null and b/Matlab/dip/lab2/rice.png differ