如何在 c++ 中执行 2D 快速傅立叶变换
我看到有一个帖子关于这个话题,但没有任何回复。
如何编写一个函数来对给定图像 f 执行二维快速傅立叶变换?
可以假设对于某些整数 m 和 n,宽度 = 2^m,高度 = 2^n,并且输入图像已经正确填充。
输入: f - 以复数表示的 2D 图像
输出: F - 变换后的系数,也以复数表示
void FFT2D(Complex<double> *f, Complex<double> *F, int width, int height)
{
}
对于每个认为我希望你为我编程的人:
我不知道。只是想要一些关于它应该如何工作的理论解释
I saw there was a post about this topic, but without any reply.
How to write a function that performs the 2D Fast Fourier Transform for a given image f?
It is possible to assume that the width = 2^m, height = 2^n for some integers m and n, and the input image is already properly padded.
Input: f - An 2D Image represented in Complex Numbers
Output: F - The transformed coefficients, also represented in Complex Numbers
void FFT2D(Complex<double> *f, Complex<double> *F, int width, int height)
{
}
For everyone who think I want you to program it for me:
I don't. Just want some theoretical explanation of how this should work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 FFTW 库 来执行此操作:
You can use the FFTW library to perform this:
我怀疑有人会为您编写 FFT 实现。这是不平凡且耗时的(您也表现出零努力)。
你明白它背后的数学原理吗?如果您了解其背后的数学原理,则需要查看各种 FFT 算法(想到的是 Cooley Tukey)并简单地实现它们。而且,这听起来像是一个家庭作业问题。
但既然你问了,这里有一个由 Google 提供的 DFT 和 FFT 的 C 实现: http://paulbourke.net/ Miscellaneous/dft/
PS:你想为我编写一个A*实现吗?
I doubt anyone's going to write a FFT implementation for you. It's non-trivial and time-consuming (you've also shown zero effort).
Do you understand the math behind it? If you understand the math behind it, you need to look at various FFT algorithms (Cooley Tukey comes to mind) and simply implement them. Also, this smells like a homework problem.
But since you asked, here's a C implementation of a DFT and FFT courtesy of Google: http://paulbourke.net/miscellaneous/dft/
PS: Do you want to write an A* implementation for me?