Université BADJI Mokhtar Annaba
Faculté des sciences de l’ingénieur
Département d’électronique
MASTER 1 Réseaux et Télécommunication
Système des Télécommunication
Tp1 : Initiation au Traitement D'image
Lire image (taille) :
img=imread('[Link]') ;
imshow(img) ;
size(img)
Afficher des images:
img=imread('[Link]');
img2=imread('[Link]');
figure;subplot(1,2,1);imshow(img);
subplot(1,2,2);imshow(img2);
Créer une image en niveau de gris
img=zeros(128);
for i=1:128
for j=1:128
img(i,j)=i+j-2;
end
end
imshow(img,gray(128));
Créer une image en noir et banc :
b=zeros(128,128);
d=ones(100,100);
b(35:65,35:65)=255;
d(35:65,35:65)=0;
figure;imshow(b);
figure;imshow(d);
Seuillage:
img=imread('[Link]');
figure;imshow(img);
img2=im2double(img);
figure;subplot(1,2,1);imshow(img);
result=(img2>0.5)
subplot(1,2,2);imshow(result);
histogramme:
I = imread(‘[Link]’);
imshow(I)
figure, imhist(I,256)
1
histo = imhist(I,256);
figure;plot(histo);
Filtrage en fonction des composantes
s=size(img);
seuil=200;
imgf = uint8(zeros(s));
for i=1:s(1)
for j=1:s(2)
if img(i,j,3)>seuil
imgf(i,j,:)=img(i,j,:);
end
end
end