Implementing DCT and IDCT in MATLAB

a=imread('abc.jpg');
x=rgb2gray(a);
[m,n]=size(x);
y=dct2(x);
x1=idct2(y);
subplot(2,3,1);
imshow(a);
title('original image');
subplot(2,3,2);
imshow(y,[0 255]);
title('DCT');
subplot(2,3,3);
imshow(x1,[0 255]);
title('IDCT');

Output

Output

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.