Open In App

2-D Inverse Cosine Transform in MATLAB

Last Updated : 12 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The 2-D inverse cosine transform is used to decode an image into the spatial domain, which is a more suitable data representation for compression (ICT). ICT-based decoding is the foundation for standards for image and video decompression. or, to put it another way, we can say that the inverse cosine transform (ICT) sums sinusoids of different frequencies and sizes to represent an image. The ict2 function is used to determine an image’s two-dimensional inverse cosine transform (ICT). The ict2 function calculates an image’s two-dimensional inverse cosine transform (ICT). The ICT has the characteristic that the majority of the visually significant information in a typical image is concentrated in just a few of the ICT coefficients.

Syntax 

Y = ict2(X)
Y = ict2(X,m,n)
Y = ict2(X,[m n])

Y = ict2(X) returns the two-layered reverse inverse cosine change (ICT) of X. Before applying the inverse transformation, Y = ict2(X,u,v) and Y = ict2(X,[u v]) pad X with 0s to size u-by-v.

Example 1:

Matlab




% MATLAB code for 
% 2-D INVERSE COSINE TRANSFORM
% PLAN THE MATRIX IN ADVANCE
X = zeros(size(Y));
Temp = zeros(size(Y));
[U V] = size(Y);
a = 1:U;
a = repmat(a',1,V);
b = repmat(1:U,V,1);
figure,
imshow(log(abs(Y)),[]);
colormap(jet);
  
title('After DCT');
for i=1:U
for j = 1: V
if(i==1)
  
AlphaO=sqrt(1/U);
else
AlphaO=sqrt(2/U);
end
  
if(j==1)
AlphaQ=sqrt(1/V);
else
AlphaQ=sqrt(2/V);
end
  
CS1=cos((pi*(2*x-1)*(i-1))/(2*U));
CS2=cos((pi*(2*y-1)*(j-1))/(2*V));
Temp=Y.*cs1.*cs2*AlphaO*AlphaQ;
X(i,j)=sum(sum(Temp));
end
end
  
% OUTPUT
figure,
imshow(abs(X),[0 300]);
title('Image after IDCT');


Output:

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads