Beruflich Dokumente
Kultur Dokumente
Faculte de Technologie
Département de Telecommunications
Introduction:
Le traitement d'images est une discipline de l'informatique et
des mathématiques appliquées qui étudie les images numériques et leurs
transformations, dans le but d'améliorer leur qualité ou d'en extraire de
l'information.
1.exercice1 :
clc
close all
clear all
A=imread('C:\Users\micro\Desktop\peppers.png');
imshow(A);
1
A(50,70,1)
A(50,70,2)
A(50,70,3)
R=uint8(zeros(size(A)));
R(:,:,1)=A(:,:,1);
figure(2)
imshow(R);
figure(3)
imhist(R(:,:,1))
2
G=uint8(zeros(size(A)));
G(:,:,2)=A(:,:,2);
figure(4)
imshow(G);
figure(5)
imhist(G(:,:,2))
B=uint8(zeros(size(A)));
B(:,:,3)=A(:,:,3);
figure(6)
imshow(B);
3
figure(7)
imhist(B(:,:,3))
k=R+G+B;
figure(8)
imshow(k)
%espace CMY
C=G+B;
M=B+R;
Y=R+G;
subplot(2,2,1)
imshow(C)
subplot(2,2,2)
imshow(M)
subplot(2,2,3)
imshow(Y)
im=C+Y+M;
subplot(2,2,4)
imshow(im)
4
%espace xyz
figure(9)
x=2.7690*R+1.7518*G+1.1300*B;
y=1.0000*R+4.5907*G+0.0601*B;
z=0.0565*G+5.5943*B;
subplot(2,2,1)
imshow(x)
subplot(2,2,2)
imshow(y)
subplot(2,2,3)
imshow(z)
im=x+y+z;
subplot(2,2,4)
imshow(im(:,:,3))
5
% yiqmap = rgb2ntsc(rgbmap);
% YIQ = rgb2ntsc(RGB)
% espace yuu
y=0.2989*R+0.5866*G+0.1145*B;
u=-0.1687*R-0.3312*G+0.500*B;
v=0.500*R-0.4183*G-0.0817*B;
figure(10)
subplot(3,1,1)
imshow(y)
subplot(3,1,2)
imshow(u)
6
subplot(3,1,3)
imshow(v)
7
%espace YIQ(NTSC)
Y=0.299*R+0.587*G+0.114*B;
I=0.596*R-0.274*G-0.322*B;
Q=0.211*R-0.523*G+0.312*B;
figure(11)
subplot(3,1,1)
imshow(Y)
subplot(3,1,2)
imshow(I)
subplot(3,1,3)
imshow(Q)
%%%%%%%%%%%%%%%%%%%%%%%%
%espace hsv rgb2hsv or hsv2rgb
8
figure(12)
im2=R+G+v;
w=rgb2hsv(im2)
imshow(w)
9
EXERCICE:
a=ones(100,600);
b=ones(100,150);
c=10*zeros(100,150);
d=0.2*ones(100,150);
e=ones(100,150);
f=ones(100,150);
g=0.9*ones(100,150);
h=zeros(100,150);
i=ones(100,150);
j=ones(100,600);
l=([a;b c d e;f g h i;j]);
imshow(l);
10
11
clc
clear all
close all
%%%%%QUESTION 4 QUANTIFICATION
x=imread('C:\Documents and
Settings\Administrateur\Bureau\IMAGES TP1\lena.png ');
imshow(x);
imagesc(x);
colormap(gray(256));
truesize;
%LE type d'image obtenue avec gray(2) est un image
binaire
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
h=(x/32)*32;
figure(2)
imshow(h);
imhist(h);
12
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%QUESTION5 ECHANTILLONAGE%%%%
figure(3)
A=imread('C:\Documents and
Settings\Administrateur\Bureau\IMAGES TP1\lena.png ');
[N,M]=size(A);
for i=1:5:N
for j=1:5:M
for k=1:5
for l=1:5
B(i+k,j+l)=A(i,j);
end
end
end
end
imshow(B)
13
clc
clear all
close all
%%%%%%%%%%%%%TP2%%%%%%%%%%
x=imread('C:\Documents and Settings\Administrateur\Bureau\IMAGES
TP1\pout.TIF')
[n,m]=size(x);
ngmax=max(max(x));
ngmin=min(min(x));
for i=1:n;
for j=1:m;
b(i,j)=(255/(ngmax-ngmin))*(x(i,j)-ngmin);
end
end
subplot(2,2,1),imshow(x);
subplot(2,2,3),imhist(x);
subplot(2,2,2),imshow(b);
subplot(2,2,4),imhist(b);
14
15