image classification using fourier transform
이전 댓글 표시
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 :
- Get the frequency domain representation F(U,v) of g(x,y) using Fourier Transform.
- What is the DC value of (u,v)?
- Select the three highest spectrum magnitudes as the image’s signature vector.
- Obtain the signature vector for each image in each class.
- 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 FFTs
figure
imshow(abs(fftshift(fftA)),[24 100000]);
colormap gray
title('Image A FFT2 Magnitude')
채택된 답변
추가 답변 (3개)
Sam Alex
2017년 12월 9일
0 개 추천
Hello Raymon, i have an assignment similar to your's, and i cant get the nearest neighbor to assign to its closest class. Could you tell me how to implement it. I would be too much thankful if you could send me your assignment to reference from it the steps of implementation to my email samalexcs1993@gmail.com. Thanks in Advance,
Image Analyst
2017년 12월 10일
The DC value is the value at element (1,1). Get this BEFORE you call fftshift, because fftshift will move the DC location to the center of the image.
To get the "three highest spectrum magnitudes" simply sort and pick off the first 3:
fftMagnitude = abs(fftA);
sortedMags = sort(fftMagnitude(:), 'descend');
threeHighest = sortedMags(1:3);
Note, fftMagnitude(:) turns the 2-D array into a column vector. Also note that in most "normal" signals, the 3 highest signals will be the DC signal and the to elements immediately on either side of the DC element. For them not to be there, you'd need to have some kind of periodic signal in the spatial domain that would give really big spikes in the Fourier (spectral) domain. If the signal is not periodic, like just some general snapshot image you snapped, then it will be highest at DC and fall away sharply as you move away from DC.
Greg Heath
2017년 12월 10일
I learned (decades ago !!!), that explictly removing the mean value before using the FFT eliminates a multitude of problems when trying to use and/or understand the transform.
Reason? The fft of the mean value contains sidelobes that contaminate the spectrum at nonzero frequencies.
Bottom line:
ALWAYS REMOVE THE DC LEVEL BEFORE TRANSFORMING!!!
Hope this helps
Thank you for formally accepting my answer
Greg
카테고리
도움말 센터 및 File Exchange에서 Nearest Neighbors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
