How to filter in frequency domain (multiplication after fft2 of an image)
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi there.
I am using fft2 and fftshift on a grayscale image. The results of this fft2 contain complex values.
After that I am trying to calculate a human-like image, i.e. the fft of an image as the eye would perceive it.
I want to accomplish this by using the well known contrast sensitivity function.
This function looks like A(f) = a * (b + c*f)*exp(-d*f)^e https://www.cg.tuwien.ac.at/research/theses/matkovic/node20.html
Inserting the results from fft2 for f does not make sense to me.
How do I apply such a filter to the results of the fft?
0 Kommentare
Antworten (1)
Image Analyst
am 17 Okt. 2016
You need to use meshgrid() to create a list of all x and y coordinates of your fft2. Make sure your origin is in the center so the max distance will be sqrt(2)*(image width/2).
X = linspace(-columns/2, columns/2, columns);
Y = linspace(-rows/2, rows/2, rows);
[x, y] = meshgrid(X, Y);
Then create a distance image by using Pythagorean theorem.
distanceImage = sqrt(x.^2 + y.^2);
These distances are the "f" in the equation. Then use that to create an A image (what a bad name!):
A = a * (b + c*distanceImage) .* exp(-d*distanceImage ) .^ e;
So now you have an A image. That is a 2-D image that is the attenuation at every frequency. Make sure you used fftshift to shift the center of your spectrum to the middle of the image. Then simply multiply and inverse fft:
filteredFFT = originalFFT .* A;
filteredSpatialDomainImage = ifft2(filteredFFT);
imshow(filteredSpatialDomainImage, []);
2 Kommentare
Image Analyst
am 18 Okt. 2016
I'll see if I have time tonight to try it. Of course the FFT is complex. As you know, (or see http://www.cv.nrao.edu/course/astr534/FourierTransforms.html if you don't, the FFT of a real, non-symmetric image is hermitian.
Siehe auch
Kategorien
Mehr zu Transforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!