Professional Documents
Culture Documents
TP3 : correction
clear all
imread('Image1.jpg'); %%function reads the image from the file specified by filename, inferring the format of the file from its con tents.
M1=ans;
subplot(5,3,1); %% function divides the current figure into an m-by-n grid and creates axes in the position specified by p
S1=M1(:,:,1);
imshow(S1);%%function displays the grayscale image I in a figure
imread('Image2.jpg');
M2=ans;
subplot(5,3,2);
S2=M2(:,:,1);
imshow(S2);
imread('Image3.jpg');
M3=ans;
subplot(5,3,3);
S3=M3(:,:,1);
imshow(S3);
I1 = imread('Image1.jpg');
subplot(5,3,4);
imhist(I1)
I2 = imread('Image2.jpg');
subplot(5,3,5);
imhist(I2)
I3 = imread('Image3.jpg');
subplot(5,3,6);
imhist(I3)
BI1=S1;
BI1(S1<100)=0;
BI1(S1>=100)=255;
subplot(5,3,7);
imshow(BI1);
BI2=S2;
BI2(S2<80)=0;
BI2(S2>=160)=255;
BI2((S2>=80) & (S2<160))=120;
subplot(5,3,8);
imshow(BI2);
BI3=S3;
BI3(S3<110)=0;
BI3(S3>=110)=255;
s ubplot(5,3,9); %% function divi des the current figure into an m-by-n gri d and creates axes i n
the position specified by p
i ms how(BI3); %%function displays the grayscale image I in a figure