Professional Documents
Culture Documents
BÀI TẬP CHƯƠNG 2
BÀI TẬP CHƯƠNG 2
subplot(2,2,2)
imshow(I_red)
title('red image')
subplot(2,2,3)
imshow(I_green)
title('green image')
green image blue image
subplot(2,2,4)
imshow(I_blue)
title('blue image')
Crop image
%crop image
I_crop=imcrop(I,[72 68 100 100]);
figure;
imshow(I_crop);
figure;
subplot(1,3,1);
imshow(I_red);
title('red'); red intensity x2 intensity x0.5
subplot(1,3,2);
imshow(I_red2);
title('intensity x2');
subplot(1,3,3);
imshow(I_red3);
title('intensity x0.5');
Subtract two images/find the difference of two images
%subtract image
I1= imread('C:\Users\ADMIN\Downloads\XLA_CN_image_data_examples\
XLA_CN_image_data_examples\circuit_no_defect.jpg');
I1_gray = rgb2gray(I1);
I2= imread('C:\Users\ADMIN\Downloads\XLA_CN_image_data_examples\
XLA_CN_image_data_examples\circuit_defect.jpg');
I2_gray = rgb2gray(I2);
figure;
imshow(I1_gray);
title('I1 gray');
figure;
imshow(I2_gray);
title('I2 gray');
I_sub = I1_gray-I2_gray;
figure;
imshow(I_sub);
title('I sub');