Académique Documents
Professionnel Documents
Culture Documents
Scientifique
Ecole Nationale d’Electronique et des Télécommunications de Sfax
TP2 :
Outils pratiques et restauration des
images
Elaboré par :
ABDALLAH AYA
Encadré par :
MR. AMRI HEDI
Classe :
2 GII 1
Exercice n=°1 :
clear all;
clc;
close all;
Résultat :
ENET’COM Traitement d’images 2ème Année GII 1
Résultat :
250
200
150
100
50
0
0 50 100 150 200 250 300
200
180
160
140
120
100
80
60
40
20
0
0 50 100 150 200 250 300
ENET’COM Traitement d’images 2ème Année GII 1
4) Le profil de la ligne 4 et la
colonne 4 de l’image Im :
figure,
plot (Im(4, :))
figure,
plot (Im(:, 4))
Résultat :
Im
4
Him x 10 Himc
1000 10
500 5
0 0
0 100 200 300 0 100 200 300
Himn Himnc
0.02 1
0.01 0.5
0 0
0 100 200 300 0 100 200 300
7)
col=imread('col01.jpg'); // Lire l’image ‘col01.jpg’
figure, imshow(col)
ENET’COM Traitement d’images 2ème Année GII 1
figure,
subplot(3,3,4), stem(Hr, 'r'), title('Hr')
subplot(3,3,5), stem(Hv, 'g'), title('Hv')
subplot(3,3,6), stem(Hb, 'b'), title('Hb')
subplot(3,3,8), stem(Hb, 'b'), hold on ,stem(Hv,
'g'), hold on, stem(Hr, 'r'), title('Hcol')
subplot(3,3,2), imshow(col), title('col')
Résultat :
col
Hr Hv Hb
10000 2000 10000
0 0 0
0 200 400 0 200 400 0 200 400
Hcol
10000
5000
0
0 200 400
ENET’COM Traitement d’images 2ème Année GII 1
9)
figure,
subplot(3,2,1), imshow(P1), title('Im')
subplot(3,2,2), stem(0: 255, Hp1), title ( [ 'L = '
, num2str(L1), ' C = ' , num2str(C1) ] )
subplot(3,2,3), imshow(P2), title('Him')
subplot(3,2,4), stem(0: 255, Hp2), title ( [ 'L = '
, num2str(L2), ' C = ' , num2str(C2) ] )
subplot(3,2,5), imshow(P3), title('Himn')
subplot(3,2,6), stem(0: 255, Hp3), title ( [ 'L = '
, num2str(L3), ' C = ' , num2str(C3) ] )
ENET’COM Traitement d’images 2ème Année GII 1
Im L = 127.4545 C = 65.5852
1000
500
0
0 100 200 300
Him L = 63.9774 C = 32.8023
2000
1000
0
0 100 200 300
4
Himn L= 213.3794 C = 49.9482
x 10
4
0
0 100 200 300
ENET’COM Traitement d’images 2ème Année GII 1
Exercice n=°2 :
2)
3) Ici on a fait l’égalisation de
l’histogramme sur 2 ,3,4,5 raies pour
la matrice M.
M2 = histeq(uint8(M), 2) // l’égalisation de
l’histogramme sur 2 raies pour la matrice M.
M3 = histeq(uint8(M), 3) // l’égalisation de
l’histogramme sur 3 raies pour la matrice M.
ENET’COM Traitement d’images 2ème Année GII 1
M4 = histeq(uint8(M), 4) // l’égalisation de
l’histogramme sur 4 raies pour la matrice M.
M5 = histeq(uint8(M), 5) // l’égalisation de
l’histogramme sur 5 raies pour la matrice M.
Résultat :
ENET’COM Traitement d’images 2ème Année GII 1
10)
Im4 = histeq(Im,4); // l’égalisation de l’histogramme
sur 4 raies pour l’image Im.
Im8 = histeq(Im,8); // l’égalisation de l’histogramme
sur 8 raies pour l’image Im.
Im16 = histeq(Im,16); // l’égalisation de
l’histogramme sur 16 raies pour l’image Im.
H = imhist(Im); //L’histogramme de Im
H4 = imhist(Im4); //L’histogramme de Im4
H8 = imhist(Im8); //L’histogramme de Im8
H16 = imhist(Im16); //L’histogramme de Im16
figure,
subplot(4,2,1), imshow(Im), title('Im')
subplot(4,2,2), stem(0: 255, H), title('Him')
subplot(4,2,3), imshow(Im4), title('Im4')
subplot(4,2,4), stem(0: 255, H4), title('H4')
subplot(4,2,5), imshow(Im8), title('Im8')
subplot(4,2,6), stem(0: 255, H8), title('H8')
subplot(4,2,7), imshow(Im16), title('Im16')
subplot(4,2,8), stem(0: 255, H16), title('H16')
5000
0
0 100 200 300
4
Im4 x 10 H4
2
1
0
0 100 200 300
Im8 H8
10000
5000
0
0 100 200 300
Im16 H16
10000
5000
0
0 100 200 300
ENET’COM Traitement d’images 2ème Année GII 1
figure,
subplot(4,2,1), imshow(ImG), title('ImG')
subplot(4,2,2), stem(0: 255, Hg), title('HImG')
subplot(4,2,3), imshow(ImG4), title('ImG4')
subplot(4,2,4), stem(0: 255, Hg4), title('H4')
subplot(4,2,5), imshow(ImG8), title('ImG8')
subplot(4,2,6), stem(0: 255, Hg8), title('H8')
subplot(4,2,7), imshow(ImG16), title('ImG16')
subplot(4,2,8), stem(0: 255, Hg16), title('H16')
4
ImG x 10 HImG
2
1
0
0 100 200 300
4
ImG4 x 10 H4
5
0
0 100 200 300
4
ImG8 x 10 H8
4
2
0
0 100 200 300
4
ImG16 x 10 H16
2
1
0
0 100 200 300
figure,
subplot(4,2,1), imshow(Im), title('Im')
subplot(4,2,2), stem(0: 255, H), title('Him')
subplot(4,2,5), imshow(Ima), title('Im Etirement')
subplot(4,2,6), stem(0: 255, Ha), title('H4
etirement')
subplot(4,2,3), imshow(Im16), title('Im16
Egalisation')
subplot(4,2,4), stem(0: 255, H16), title('H16
Egalisation')
ENET’COM Traitement d’images 2ème Année GII 1
Im Him
8000
6000
4000
2000
0
0 50 100 150 200 250 300
6000
4000
2000
0
0 50 100 150 200 250 300
Im Etirement H4 etirement
8000
6000
4000
2000
0
0 50 100 150 200 250 300
ImGa = imadjust(ImG);
Hga = imhist(ImGa);
figure,
subplot(4,2,1), imshow(ImG), title('ImG')
subplot(4,2,2), stem(0: 255, Hg), title('Hgim')
subplot(4,2,5), imshow(ImGa), title('ImG Etirement')
subplot(4,2,6), stem(0: 255, Hga), title('Hg4
etirement')
subplot(4,2,3), imshow(ImG16), title('ImG16
Egalisation')
subplot(4,2,4), stem(0: 255, Hg16), title('Hg16
Egalisation')
ENET’COM Traitement d’images 2ème Année GII 1
ImG Hgim
15000
10000
5000
0
0 50 100 150 200 250 300
1.5
0.5
0
0 50 100 150 200 250 300
1.5
0.5
0
0 50 100 150 200 250 300