Tuesday, 12 December 2017

DFT ANALYSIS OF AN IMAGE

By Ask Biomedical



clc;
clearall;
closeall;
warningoff;
a=imread('flower.tif');
b=im2double(a);
[M N]=size(b);
[u x]=meshgrid(0:N-1:0:N-1);
ker=(exp(-(j*(2*pi*(x.*u))/N)))/sqrt(N);
trans1=ker*b*ker;
invker=(exp(j*2*pi*(x.*u)/N))/sqrt(N);
orig1=invker*trans1*invker;
trans=fftshift(abs(trans1));
subplot(2,2,1);
imshow(a);
xlabel('fig 5.1 original image');
subplot(2,2,2);
imshow(trans);
xlabel('fig 5.2 Discrete Fourier Transform image');
subplot(2,2,3);
imshow(orig1);
xlabel('fig 5.3 dft reconstruct image');
for i=1:M
for j=1:N
        error(i,j)=(b(i,j)-orig1(i,j)^2);
end
end
error1=sum(sum(error))/(M*N);
subplot(2,2,4);
imshow(error1);
xlabel('Discrete Fourier Transform error image');

0 comments:

Post a Comment