我是快速傅立叶变换(FFT)的新手,对于如何用C++这样的编程语言进行计算并没有太多的想法。这是FFT2D的方法

void FFT2D(Complex<double> *f, Complex<double> *F, int width, int height);
It takes an input image f of size width * height and output the transformed
coefficients into F.

提示:图像像素存储为三个单独的图像颜色(R,G,B)平面,每个平面由一维复数数组表示。假设图像的大小为宽度W和高度H,则可以找到图像位置(m,n)上像素的颜色分量值(R,G和B)为R [m + n * W],G( m + n * W)和B [m + n * W],其中R,G,B是复数的三个数组。
变换后的系数的一维数组也以相同的方式表示。

我只需要为一个颜色分量实现处理,编程模板将根据实现的功能分别处理R,G,B。模板还将用零填充图像,以便每个输入图像的大小为2m * 2n。
If I called from another class, I have to pass R, G, B separately
Suppose:
Complex<double> *R = new Complex<double>[width * height];
Let, width = 4096 and height 4096
FFT2D(R, output F, width, height) for compute “R” color component;
FFT2D(G, output F, width, height) for compute “G” color component;
FFT2D(B, output F, width, height) for compute “B” color component;

We have template of calculated FFT1D function:
void FFT1D(Complex<double> *fx, Complex<double> *Fu, int twoK, int stride)
Hint: it outputs the frequency coefficients in the array Fu.

FFT1D从FFT2D的函数内部进行调用。我在C,C++,Java和FFT2D的C#中发现了几种不同类型的代码。他们中的大多数已经使用2D阵列结构实现了。他们在行和列的循环中为2D数组结构分配实部和虚部。但是,在我的情况下是颜色分量的一维数组结构。

让我们做一些代码,这是FFT2D函数内部的代码:
Complex<double> *outPutMap = new Complex<double>[width * height];
 for (int i = 0; i < height; i++){
 #  for(int j = 0; j < width; j++){
 #     outPutMap[i + j * width] = f[i + j * width];
 #      I don’t understand how to implement in here for color component and how
 #      it assign a value for real and imaginary part
 #   }
  }

在调用FFTID之前,还需要像书中那样计算2K的值,M = 2K

如果您有任何想法或引用,请告诉我。

谢谢

问候
一郎

最佳答案

我建议您拿一本书,例如[Numerical Recipes] [1]。

http://www.amazon.com/Numerical-Recipes-Art-Scientific-Computing/dp/0521750334

FFT,Simpsons规则,Fouriers Algorith都应该存在。我从一位名叫拉贾拉姆(Rajaram)的作家那里读过..

09-08 05:04