Clear Filters
Clear Filters

image compressing with DCT

5 views (last 30 days)
adi
adi on 22 Nov 2011
what is the coding Elimination of DCT coefficients for jpeg image compression ?? i using matlab R2008a
help me..
  1 Comment
Walter Roberson
Walter Roberson on 22 Nov 2011
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

Sign in to comment.

Answers (1)

Hamrit
Hamrit on 13 May 2012
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

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!