Lets Learn together... Happy Reading

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

2-D Inverse Discrete Cosine Transform


Consider the result obtained after DCT. (Check 2d-DCT )
Apply Inverse Discrete Cosine Transform to obtain the original Image.




MATLAB CODE:

%2-D INVERSE DISCRETE COSINE TRANSFORM
%PREALLOCATE THE MATRIX
A=zeros(size(B));
Temp=zeros(size(B));
[M N]=size(B);

x=1:M;
x=repmat(x',1,N);
y=repmat(1:N,M,1);

figure,
imshow(log(abs(B)),[]);colormap(jet);title('After DCT');







for i=1:M
    for j = 1: N
   
        if(i==1)
          AlphaP=sqrt(1/M);
        else
          AlphaP=sqrt(2/M);
        end
       
        if(j==1)
          AlphaQ=sqrt(1/N);
        else
          AlphaQ=sqrt(2/N);
        end
                 
        cs1=cos((pi*(2*x-1)*(i-1))/(2*M));
        cs2=cos((pi*(2*y-1)*(j-1))/(2*N));
        Temp=B.*cs1.*cs2*AlphaP*AlphaQ;
              
          A(i,j)=sum(sum(Temp));
    end
end
%OUTPUT
figure,
imshow(abs(A),[0 255]);title('Image after IDCT');












like button Like "IMAGE PROCESSING" page

1 comments:

unknown said... Reply to comment

Hi, but this significantly differs from the Matlab IDCT function. Any reason why? Thanks

Enjoyed Reading? Share Your Views

Previous Post Next Post Home

Link

Related Posts Plugin for WordPress, Blogger...
Google ping Hypersmash.com