如何根据极坐标将矩阵划分为一系列容器
我正在尝试在 Octave/Matlab 中编写一个程序,旨在获取图像,对该图像执行 2D 快速傅里叶变换,然后获取 FFT 数据并将其划分为一系列容器,从中可以得出平均 FFT 强度被计算。这些箱需要计算该光谱的每个 5 度段的傅里叶光谱的强度:
即想象一个 500x500 的阵列,然后将其分成 72 个相等的切片(就像切片披萨一样),每个切片相距 5 度。然后,这些切片形成箱,并计算其中值的平均值。
据我了解,要生成此结果,我必须将所得 FFT 的笛卡尔坐标转换为极坐标,以便我可以使用 theta 值计算 bin。此外,为了像披萨一样分割阵列,极坐标必须源自图像的中心。我很清楚如何做到这一点,但是一旦完成此操作,我就陷入如何将数组划分到容器中的问题。
有人可以帮忙吗?假设这个解释有道理?
I'm trying to write a program in Octave/Matlab that aims to take an image, perform the 2D Fast Fourier Transform on that image, and then take the FFT data and divide it into a series of bins from which the mean FFT intensity can be calculated. These bins need to calculate the intensity of the fourier spectrum for each 5 degree segment of that spectrum:
i.e. Imagine a 500x500 array, then divide it into 72 equal slices (like a slicing a pizza) with each slice being 5 degrees apart. These slices then form the bins and an average of the values within them is calculated.
I understand that to produce this, I must convert the Cartesian coordinates of the resultant FFT into Polar coordinates, so that I can calculate the bins using values of theta. In addition, to slice the array up like a pizza, the Polar coordinates must originate at the center of the image. I have a good idea how to do this, but I am stuck on how to divide the array up into the bins once I have completed this.
Can anyone help? Assuming that this explanation makes sense?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,这并不完全清楚。
但我假设您指的是傅立叶域中的极坐标,在这种情况下,您可以从
atan2(f_y, f_x)
中获取每个点的角度,其中f_y
和f_x
是傅里叶域中的 y 和 x 坐标。对于 FFT,这些通常通过排序与数组索引相关。对于 matlab,另请参阅 快速移位
Actually, it's not completely clear.
But I assume you mean polar coordinates in the fourier domain, in which case you can get the angle of each point from something like
atan2(f_y, f_x)
wheref_y
andf_x
are the y and x coordinates in the fourier domain. With FFTs, these are usually related to the array index by the orderingFor matlab, see also fftshift