partie 2 :DeCompression :

 

Transformation des couleurs inverse (YCbCr > RVB)

function [r,v,b]=torvb(y,cb,cr)

% Transformation YCBCR en RVB 

nl=0;cb=cb-128;cr=cr-128;

while nl<8

nc=0;

while nc<8

  A=inv([0.299 0.587 0.114;0.5 -0.41869 -0.08131; -0.16875 -0.33126 0.5]);

  D=double(A)*double([y(1+nl,1+nc);cb(1+nl,1+nc);cr(1+nl,1+nc)]);

  r(nl+1,nc+1)=D(1,1); v(nl+1,nc+1)=D(2,1); b(nl+1,nc+1)=D(3,1);

  nc=nc+1;

end

nl=nl+1;

end % end while

r=round(r);v=round(v);b=round(b);

r(r>255)=255;r(r<0)=0;

v(v>255)=255;v(v<0)=0;

b(b>255)=255;b(b<0)=0;