Sunteți pe pagina 1din 2

Cmpression-dcoupage en bloc

http://www.imagenumerique.50webs.com/codes/compression/decoupag...

IMAGE NUMERIQUE

Compression JPEG & JPEG 2000 Home Support Codes matlab Formations Auteurs

PARTIE 1 :COMPRESSION :
Dcoupage en blocs
function decoupage(file) %Rcuprer les matrices R,V et B et complter les blocs pour avoir la forme % 8x8 a=imread(file);[n nn zzz]=size(a); save fichiers_mat/info_image if zzz~=3 RR=a; RR= comp_block (RR) ; %gray mode else RR=a(:,:,1); RR= comp_block (RR); %rvb mode VV=a(:,:,2); VV= comp_block ( VV); BB=a(:,:,3); BB= comp_block (BB); end % end if [lRR,cRR]=size(RR); no=n;nno=nn; n=lRR;nn=cRR; t=n*nn; save fichiers_mat/dim; indice=0; % indice=1 si nuance de gris , =0 si RVB %%%%%MODE NUANCE DE GRIS if zzz~=3 indice=1; x=1; nl=0; while nl<n nc=0; while nc<nn && x<=t for ligne=1:8 for colonne=1:8 Z(ligne,colonne)=RR(ligne+nl,colonne+nc); end % end for colonne end % for ligne eval(['G',num2str(x),'=Z;']) x=x+1;nc=nc+8; end % end while xx=x-1;nl=nl+8; end % end while end % end if %%%%%%% MODE RVB if indice == 0 %Rcuprer les matrices du rouge x=1; nl=0; while nl<n nc=0; while nc<nn && x<=t cliquez sur la fonction "comp_block()" pour afficher son contenu

for ligne=1:8 for colonne=1:8 Z(ligne,colonne)=RR(ligne+nl,colonne+nc); end % end for colonne end % for ligne eval(['R',num2str(x),'=Z;']) x=x+1;nc=nc+8;

1 sur 2

17/02/2013 11:59

Cmpression-dcoupage en bloc

http://www.imagenumerique.50webs.com/codes/compression/decoupag...

end % end while xx=x-1; save fichiers_mat/dim; nl=nl+8; end % end while %Rcuprer les matrices du rouge vert x=1; nl=0; while nl<n nc=0; while nc<nn && x<=t

for ligne=1:8 for colonne=1:8 Z(ligne,colonne)=VV(ligne+nl,colonne+nc); end % end for colonne end % for ligne eval(['V',num2str(x),'=Z;']) x=x+1;nc=nc+8; end % end while nl=nl+8; end % end while %Rcuprer les matrices du rouge bleu x=1; nl=0; while nl<n nc=0; while nc<nn && x<=t for ligne=1:8 for colonne=1:8 Z(ligne,colonne)=BB(ligne+nl,colonne+nc); end % end for colonne end % for ligne eval(['B',num2str(x),'=Z;']) x=x+1; nc=nc+8; end % end while nl=nl+8; end % end while end % if indice save fichiers_mat/matrices;

Projet de fin d'tudes 2009-2010 Copyright : tous droits rservs

2 sur 2

17/02/2013 11:59

S-ar putea să vă placă și