24
Matlab Kais BACCOUR

Matlab formation Sound and image Processing

Embed Size (px)

Citation preview

Page 1: Matlab formation Sound and image Processing

Matlab

Kais BACCOUR

Page 2: Matlab formation Sound and image Processing

Matlab ??

Page 3: Matlab formation Sound and image Processing

fenêtresCurrent directoryCommand historyWork space (variables)Command windowCd , clc(clear screen) , ls ,mkdir , rmdirClear (clear work space)

Page 4: Matlab formation Sound and image Processing

Opérations simplesAffectation de variablesAffichage de contenu de variables;WhosRandRandnhelp

Page 5: Matlab formation Sound and image Processing

Déclaration de vecteursVecteursV=[1,2,3]v=[1 2 3]w=1:0.1:10Z=10:-1:0V2=v((0 :10)) /3

Page 6: Matlab formation Sound and image Processing

Affichage courbeEdit(ouvrir fichier mtab)Plot(sig)Xlabel(‘echantillon’)YlabelTitle(‘100 hz battement de cœur’)HoldonPlot(sig,’ro’) (r=red) Axis([0 100 -20 20])

Page 7: Matlab formation Sound and image Processing

Fonctions sur les vecteursLength Max Min MeanSizeDoc maxHelp maxRandn(1,7)Zeros(1,256)

Page 8: Matlab formation Sound and image Processing

Operation sur les vecteursv1+v2V1-v2V1*3V1*v2V1.*v3V1./v3V1’

Page 9: Matlab formation Sound and image Processing

Accès à un élément du vecteurV(1)Find(v>4)V(5:7)

Page 10: Matlab formation Sound and image Processing

Modifier la valeur d’un élèment du vecteur

v(3)=5

v(3:5)=0

Page 11: Matlab formation Sound and image Processing

Déclaration des matricesM=[1,2,3;4 5 6;7,8,9]M=[1:5;1:5]

Page 12: Matlab formation Sound and image Processing

Opérations sur les matricesm+m1m*m1m.*m1m*3

Page 13: Matlab formation Sound and image Processing

Fonctions sur les matricesTransp(M) ,transpose(m);M’;Trace(m) %somme de la diagonaleeye(4) %matrcice carrée identité 4*4Ones(3)Zeros(6)size(m)rank(m)Randn(3)

Page 14: Matlab formation Sound and image Processing

Max(m)Sum(m)Min(m)

Page 15: Matlab formation Sound and image Processing

Accès matricem(2,3)Exercice

1 2 3 4 45 6 7 8 59 1 2 3 34 5 6 7 22 6 8 4 2

Acceder à la matrice en rouge

Page 16: Matlab formation Sound and image Processing

Son

Page 17: Matlab formation Sound and image Processing

chargement d’un fichier audio wavWavread(‘fichier.wav’);

Guitar=wavread(‘guitar.wav’);

Wavplay(s,Fs);

Wavrecord(n,Fs)

Wavwrite(x,Fs,’name’)

Page 18: Matlab formation Sound and image Processing

Affichage du sonPlot

Page 19: Matlab formation Sound and image Processing

Traitement audioObtenir la longueur du signal en secondeDécouper signal de la seconde 10 jusqu’à 16Découper un autre signal de la seconde 12

jusqu’à 13 et le repeter 3 fois %drumsd_rep=[d ; d ; d ];Length(v)/fs

Page 20: Matlab formation Sound and image Processing

Additions de plusieurs signauxAddition,Amplification Lecture

Page 21: Matlab formation Sound and image Processing

Génération d'un son pur

fe = 44000; % Fréquence d'échantillonnage N = fe*1; % Nombre de points de la séquence

% Axe des temps t = (0:N-1)/fe; % Génération du sinus f1 = 1300; x =sin(2*pi*f1*t); sound(x)

Page 22: Matlab formation Sound and image Processing

fftN=length(s);Fs=44100;Ts=1/Fs;Tmax=(N-1)*Ts;t=0:Ts:Tmax;F=-Fs/2:Fs/(N-1):Fs/2;Z=fftshift(fft(s));plot(F,(abs(Z)));

Page 23: Matlab formation Sound and image Processing

Image????

Page 24: Matlab formation Sound and image Processing

Niveau de gris[m,n,p]=size(aa);nouv=uint8(zeros(m,n));for i=1:m for j=1:n

nouv(i,j)=uint8(aa(i,j,1)*0.25+aa(i,j,2)*0.65+aa(i,j,3)*0.1);

endend;imshow(nouv);