# MATLAB: Image classification using fourier transform

fftimage processingImage Processing Toolbox

I can get the Fourier transform frequency domain using the MATLAB fft2() code, but I want to get the highest spectrum magnitudes and the DC. What should I do?
The purpose is to :
1. Get the frequency domain representation F(U,v) of g(x,y) using Fourier Transform.
2. What is the DC value of (u,v)?
3. Select the three highest spectrum magnitudes as the image’s signature vector.
4. Obtain the signature vector for each image in each class.
5. Use nearest neighbor to assign f(u,v) to its closest class.
I found this code that gets the magnitude:
% Perform 2D FFTs fftA = fft2(double(imageA));% Display magnitude and phase of 2D FFTsfigureimshow(abs(fftshift(fftA)),[24 100000]);colormap graytitle('Image A FFT2 Magnitude')

fftMagnitude = abs(fftshift(fftA));maxValue = max(fftMagnitude(:));