1
$\begingroup$

My goal is to analyze the frequencies in an image representing water simulation data before and after, for example, a Gaussian filter. The direction of these frequencies is not important to me. Ideally, I think I want to plot these frequencies in a 2D graph, where x represents the frequency, ranging from 0 to 0.5, and y represents the amplitude.

I understand how to obtain the 1D frequencies, as is explained here: https://stackoverflow.com/questions/4364823/how-do-i-obtain-the-frequencies-of-each-value-in-a-fft. From this, I also understand how to obtain the frequencies in x- and y- direction.

What I do not fully understand is what the direction-independent frequencies of my output values are. Intuitively, I would expect to calculate them like so:

// from output to frequencies to periods
fx = kx / N; fy = ky / M
px = 1/fx; py = 1/fy

// direction independent frequency of output value
period = sqrt(px*px + py*py)
frequency = 1/p

However, when I read about this particular subject, I find something different:

frequency

From what I understand, u and v are the x- and y- frequencies respectively, in cycles per unit distance. This would mean that, if I have a signal with x- and y- frequencies of both 0.5, the resulting frequency is 0.707... ? This is over the Nyquist limit, even more so diagonally! I have a feeling I am missing something, but I can't find what.

Additionally, what do the frequencies with an x- or y- frequency of 0 or 0.5 mean? In 1D, they would be the DC and Nyquist component. How does this translate to 2D, where the other may have a perfectly fine value? More practically, which frequencies can I use for my graph?

$\endgroup$

migrated from stackoverflow.com Apr 9 '15 at 16:18

This question came from our site for professional and enthusiast programmers.

0
$\begingroup$

It's not over your Nyquist limit, because you're doing sampling at your nyquist rate in two independent dimensions and look at the combined result.

Your square-root formula is easily explained: It's pythagoras, matching your combined frequencies in x and y to a single frequency.

$\endgroup$
  • $\begingroup$ It's just that it seems over the limit of what you can sample diagonally. A frequency of 0.7 is greater than what I would expect from a diagonally neighbouring pair of cells, since the distance between them is larger than between two adjacent cells. $\endgroup$ – Selmar Apr 10 '15 at 12:17
  • $\begingroup$ I think I just had it wrong conceptually. I managed to understand it better by looking at the function sin(PI/10*(x+y)). It clearly has one period in the x- and y- direction, but two periods diagonally. $\endgroup$ – Selmar Apr 10 '15 at 12:19
  • $\begingroup$ Ok! It did not help me as much intuitively, but you did give the right answer. As for my last question. Am I correct in thinking that there are four values at the Nyquist frequency in a full 2D FFT, one in every diagonal direction? $\endgroup$ – Selmar May 19 '15 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.