Académique Documents
Professionnel Documents
Culture Documents
I = imread('Desert.jpg');
figure();
imshow(I);title('original img');
R=I(:,:,1);
G=I(:,:,2);
B=I(:,:,3);
Gray = (R+G+B)/3;
figure();
imshow(‘Gray’);
figure();
subplot(321);
imhist(R);title('histogram of R scale');
subplot(322);
imshow(R);title('R-scale img');
subplot(323);
imhist(G);title('histogram of G scale');
subplot(324);
subplot(325);
imhist(B);title('histogram of B scale');
subplot(326);
#Getting the histograms of all the scales using imhist command which can be used for thresholding
R1=(R<150);
R2=im2bw(R,0.44);
figure();
subplot(321);
subplot(322);
imshow(R2);title('cmd threshold R scale');
G1=(G>100&G<150);
G2=im2bw(G,0.75);
subplot(323);
subplot(324);
B1=(B>200&B<220);
B2=im2bw(B,0.66);
subplot(325);
subplot(326);
# thresholding of the RGB scales using im2bw command and manual by the histogram graph
Conclusion:
In this experiment had done the thresholding on BW and color images. The main use of the thresholding is to get the
part of image which we want. It literally mean that extracting a part of image either automatically (or) by manually.
For doing that job manually we need the histogram of the image. By the histogram we can set the range of the image
to be extracted.