我在快速傅立叶新变换(FFT),并没有太多的想法,它的编程语言如C++如何计算。下面是FFT2D如何执行FFT2D(快速傅立叶变换2D)R,G,B颜色分量
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是三个复数阵列。 1D阵列的变换的系数是代表也以相同的方式。
我需要实现的处理只对一个彩色分量和所述编程模板将处理将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#中发现了几种不同类型的代码。他们中的大多数都使用二维数组结构实现;他们将实部和虚部分配给行和列循环中的二维数组结构。但是,在我的情况下是一维颜色分量的数组结构。
让我们,做一些代码,这是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,还需要计算twoK的价值在本书中,M = 2K
如果您有任何想法或任何参考请让我知道。
谢谢
问候 一郎
使用[FFTW](http://www.fftw.org)库。 –