I am trying to get the 1D power histogram of all the frequencies of certain images. I will describe what I have done so far.
- Read the image (if neccessary, convert to grayscale)
- Calculate the FFT2 and shift it
- In the Fourier domain, apply some filters
Retransform to the spatial domain and display (for visual verification that the filter worked)
FFT2 and fftshift that newly created image (optional, I could have used the former ifft2 input as well)
- Calculate the power spectrum, i.e. .^2 all the fourier domain values
Now begins the tricky part. For a power histogram I'd have to get all the values of a certain frequency, for all frequencies involved. With a contiuous signal, I'd just integrate from 0 to 2pi for all frequencies, and that's it.
But I cannot integrate with discrete values, at least I think it is wrong. And for an integration from 0 to 2pi, I'd have to sum up all values with a certain distance to the 0th frequency. I cannot to that because then I'd have to determine the distance from the centre, which will fail because the values are located in a square matrix. If I were to sum up the values from a ring of finite width, then I'd have to make sure not to select some values multiple times.
Maybe I'm just thinking in a wrong direction, because I am relatively new to MATLAB. But how can I calculate such power histograms?
Phreak