1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| x=multibandread ('D:\S1\compression image\TP_Master_2\aeropport_400_400',...
[400 400 6],'uint8=>uint8',...
0,'bsq','ieee-le',{'band','direct',[1 2 3 4 5 6]} );
% EXTRACTION DE LA BANDE 6 qui va etre mon image de depart
bande6=x(:,:,6);
%ENREGISTREMENT DE LIMAGE SOUS FORMAT JPG
imwrite(bande6,'D:\S1\compression image\TP_Master_2\wahid.jpg','jpg')
% CALCUL DU TAUX DE COMPRESSION (c'est incomplet c'est le prof qui a dit %cela sans pour autant savoir comment obtenir ce taux de compressionn)
fid=fopen('D:\S1\compression image\TP_Master_2\aeropport_400_400','r');
status=fseek(fid,0,'eof');
position=ftell(fid)
%DECOMPRESSION LECTURE
jpg=imread('D:\S1\compression image\TP_Master_2\wahid.jpg','jpg');
% ERREUR QUADRATIQUE MOYENNE
for i=1:400
for j=1:400
diff=sum((bande6(i,j)-jpg(i,j)).^2);
end
end
EQM=diff/(400*400) |
Partager