image compressing with DCT

2 次查看(过去 30 天)
adi
adi 2011-11-22
what is the coding Elimination of DCT coefficients for jpeg image compression ?? i using matlab R2008a
help me..
  1 个评论
Walter Roberson
Walter Roberson 2011-11-22
I do not understand this question as phrased, unless it is a duplicate of your other question http://www.mathworks.com/matlabcentral/answers/21891-jpeg-image-compressing-with-dct

请先登录,再进行评论。

回答(1 个)

Hamrit
Hamrit 2012-5-13
dvalue=imread('yourimage');
dvalue = double(dvalue)/255;
dvalue = rgb2gray(dvalue);
imshow(dvalue)
img_dct=dct2(dvalue);
img_pow=(img_dct).^2;
img_pow=img_pow(:);
[B,index]=sort(img_pow);%no zig-zag
B=flipud(B);
index=flipud(index);
compressed_dct=zeros(size(dvalue));
coeff = 20000;% maybe change the value
for k=1:coeff
compressed_dct(index(k))=img_dct(index(k));
end
im=idct2(compressed_dct);
imwrite(im, 'Hassan.jpg')
not for color Jpeg

类别

Help CenterFile Exchange 中查找有关 Denoising and Compression 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by