CUDA cufftPlan2d 计划尺寸问题
我正在研究Nvidia CUDA sdk的卷积FFT2D示例背后的代码,但我不明白这一行的要点:
cufftPlan2d(&fftPlan, fftH, fftW/2, CUFFT_C2C);
显然,这初始化了要运行的FFT的复杂平面,但我不明白这一点将计划宽度除以 2。
准确地说:fftH 和 fftW 是 imageX+kernelX+1 和 imageY+kernelY+1 尺寸的舍入值(仅出于速度原因)。我知道在频域中通常有一个相同频率的正分量和一个对称负分量..但这听起来像是削减了我的图像数据的一半..
有人可以向我解释一下吗?我从未使用过 FFT(我只知道傅里叶变换背后的理论)
I'm studying the code behind the convolutionFFT2D example of the Nvidia CUDA sdk, but I don't get the point of this line:
cufftPlan2d(&fftPlan, fftH, fftW/2, CUFFT_C2C);
Apparently this initializes a complex plane for the FFT to be running in, but I don't see the point of dividing the plan width by 2.
Just to be precise: the fftH and fftW are rounded values for imageX+kernelX+1 and imageY+kernelY+1 dimensions (just for speed reasons). I know that in the frequency domain you usually have a positive component and a symmetric negative component of the same frequency.. but this sounds like cutting half of my image data away..
Can someone explain this to me a little better? I've never used a FFT (I just know the theory behind a fourier transformation)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您执行实数到复数 FFT 时,由于对称性,一半的频域数据是冗余的。但这只是 2D FFT 的一个轴的情况。您可以将 2D FFT 视为两个 1D FFT 运算,第一个运算对所有行进行操作,对于实值图像,这将为您提供复杂的行值。在第二阶段,您对每一列应用一维 FFT,但由于行值现在很复数,这将是复数到复数的 FFT,输出中没有冗余。因此,您只需要水平轴上的宽度 / 2 点,但垂直轴上仍然需要高度。
When you perform a real to complex FFT half the frequency domain data is redundant due to symmetry. This is only the case in one axis of a 2D FFT though. You can think of a 2D FFT as two 1D FFT operations, the first operates on all the rows, and for a real valued image this will give you complex row values. In the second stage you apply a 1D FFT to every column, but since the row values are now complex this will be a complex to complex FFT with no redundancy in the output. Hence you only need width / 2 points in the horizontal axis, but you still need height pointe in the vertical axis.