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
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