feat(dip) lab2 half
This commit is contained in:
parent
c4cf8396e0
commit
9418196104
11 changed files with 165 additions and 0 deletions
BIN
Matlab/dip/lab2/A.bmp
Normal file
BIN
Matlab/dip/lab2/A.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
BIN
Matlab/dip/lab2/B.bmp
Normal file
BIN
Matlab/dip/lab2/B.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
20
Matlab/dip/lab2/lab2_1.m
Normal file
20
Matlab/dip/lab2/lab2_1.m
Normal file
|
@ -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');
|
20
Matlab/dip/lab2/lab2_2.m
Normal file
20
Matlab/dip/lab2/lab2_2.m
Normal file
|
@ -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');
|
20
Matlab/dip/lab2/lab2_3.m
Normal file
20
Matlab/dip/lab2/lab2_3.m
Normal file
|
@ -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');
|
26
Matlab/dip/lab2/lab2_4.m
Normal file
26
Matlab/dip/lab2/lab2_4.m
Normal file
|
@ -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');
|
20
Matlab/dip/lab2/lab2_5.m
Normal file
20
Matlab/dip/lab2/lab2_5.m
Normal file
|
@ -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');
|
20
Matlab/dip/lab2/lab2_6.m
Normal file
20
Matlab/dip/lab2/lab2_6.m
Normal file
|
@ -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');
|
19
Matlab/dip/lab2/lab2_7.m
Normal file
19
Matlab/dip/lab2/lab2_7.m
Normal file
|
@ -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');
|
20
Matlab/dip/lab2/lab2_8.m
Normal file
20
Matlab/dip/lab2/lab2_8.m
Normal file
|
@ -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');
|
BIN
Matlab/dip/lab2/rice.png
Normal file
BIN
Matlab/dip/lab2/rice.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
Reference in a new issue