{"action":"opened","issue":{"url":"https://api.github.com/repos/ele747/laboratoire6/issues/3","repository_url":"https://api.github.com/repos/ele747/laboratoire6","labels_url":"https://api.github.com/repos/ele747/laboratoire6/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/ele747/laboratoire6/issues/3/comments","events_url":"https://api.github.com/repos/ele747/laboratoire6/issues/3/events","html_url":"https://github.com/ele747/laboratoire6/issues/3","id":148241770,"number":3,"title":"%% Compression avec perte d'information","user":{"login":"hrhouma","id":10111526,"avatar_url":"https://avatars.githubusercontent.com/u/10111526?v=3","gravatar_id":"","url":"https://api.github.com/users/hrhouma","html_url":"https://github.com/hrhouma","followers_url":"https://api.github.com/users/hrhouma/followers","following_url":"https://api.github.com/users/hrhouma/following{/other_user}","gists_url":"https://api.github.com/users/hrhouma/gists{/gist_id}","starred_url":"https://api.github.com/users/hrhouma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrhouma/subscriptions","organizations_url":"https://api.github.com/users/hrhouma/orgs","repos_url":"https://api.github.com/users/hrhouma/repos","events_url":"https://api.github.com/users/hrhouma/events{/privacy}","received_events_url":"https://api.github.com/users/hrhouma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-14T03:35:14Z","updated_at":"2016-04-14T03:35:14Z","closed_at":null,"body":"load clown;\r\nI = ind2gray(X, map);\r\ncolormap(gray(128));\r\nI_dct = dct2(I); % Transformée discrète en cosinus\r\nI_comp = I_dct;\r\nI_comp(abs(I_comp) < 0.2 ) = 0; % Seuillage des coefficients\r\nrat_tot = numel(I_comp);\r\nrat_0 = sum(I_comp(:) ~= 0);\r\nratio = rat_tot/rat_0; % Ratio de compression\r\nfprintf('Le ratio de compression est de %f : 1\\n', ratio);\r\nI_comp = abs(idct2(I_comp));\r\n% Affichage de l'image compressé\r\nfigure;\r\nsubplot(2,2,1), imshow(I), title('a) Image originale');\r\nsubplot(2,2,2), imshow(log(abs(I_dct)), []), title('b) Image en transformée discrète en cosinus (affichage logarithmique)');\r\nsubplot(2,2,3), imshow(I_comp, []), title('c) Image compressée');\r\n% Calcul du Mean Squared Error (MSE)\r\nmse_val = mse(I_comp, I);\r\nfprintf('MSE= %d\\n', mse_val);\r\n% Calcul du Peak Signal-to-Noise Ratio (PSNR)\r\npsnr_val = psnr(I_comp, I);\r\nfprintf('PSNR= %d\\n', psnr_val);"}}