Friday, 21 September 2012


Applying DFT on image matrix & Performing the IDFT

Code
clc;
close all;
sum=0;
a=imread('D:\final print\dip speech\images8.jpg');

b=a;
M=50;
N=50;

for x=1:50
                    for y=1:50
                                b(x,y)=a(x,y);
                    end
end
c=double(b);

for u=1:M
                     for v=1:N
                             s=0;
                              for x=1:M
                                     for y=1:N
                                             s=s+c(x,y)*exp(1*j*2*pi*(((u*x)/M)+((v*y)/N)));
                                     end
                             end
                
                            F(u,v)=s;
                      end
end

for x=1:M
                     for y=1:N
                             s=0;
                             for u=1:M
                                       for v=1:N
                                             s=s+F(u,v)*exp(-1*j*2*pi*(((u*x)/M)+((v*y)/N)));
                                       end
                                end
                   
                             inf(x,y)=s/(M*N);
                    end
end

subplot(2,2,1);
imshow(uint8(c));
title('ORIGINAL IMAGE');

subplot(2,2,2);
imshow(uint8(F));
title('DFT IMAGE');

subplot(2,1,2);
imshow(uint8(inf));
title('IDFT IMAGE');

Output of DFT on image matrix


Related Posts :



1 comment: