% it creates a simple gray image (4x4) | |
I = [255, 255, 30, 100 | |
255, 50, 90, 20 | |
70, 70, 20, 10 | |
100, 20, 10, 0]; | |
% it converts it to grayscale | |
I = mat2gray(I); | |
% shows it | |
imshow(I); | |
IDFT = []; | |
% DFT | |
N1 = 4; | |
N2 = 4; | |
e = exp(1); | |
% DFT implementation | |
for u=0:(N1-1) | |
for v=0:(N2-1) | |
% X(u, v) | |
DFT = 0; | |
for x=0:(N1-1) | |
for y=0:(N2-1) | |
Intensity = I(x+1,y+1); | |
FirstDimension = e ^ (-1i*( (2*pi/N1) * u * x)); | |
SecondDimension = e ^ (-1i*( (2*pi/N2) * v * y)); | |
DFT = DFT + (Intensity * FirstDimension * SecondDimension); | |
end | |
end | |
IDFT(u+1, v+1) = DFT; | |
end | |
end | |
IDFT | |
%MATLAB_FFT=fft2(I) | |
surf(log(abs(fftshift(IDFT)))); | |
InverseI=abs(ifft2((IDFT))) | |
I |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
http://share.pho.to/ARkgK