如何执行FFT2D(快速傅里叶变换2D) R, G, B颜色分量

How to perform FFT2D (Fast Fourier Transform 2D) R, G, B color component

本文关键字:2D 分量 颜色 变换 何执行 执行 FFT2D 傅里叶      更新时间:2023-10-16

我是快速傅里叶变换(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)平面,每个平面由1D复数数组表示。假设图像宽度为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的函数内部调用。我在《FFT2D》的C、c++、Java和c#中找到了几种不同类型的代码。它们大多采用二维阵列结构实现;它们在行和列的循环中对二维数组结构赋实部和虚部。然而,在我的情况下,是1D数组结构的颜色组件。

让我们写一些代码,这是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

如果你有任何想法或参考,请告诉我。

谢谢

的问候一郎

我建议你找一本像[Numerical Recipes][1]这样的书。

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

FFT,辛普森法则,傅立叶算法应该都在那里。我读过一位名叫拉贾拉姆的作家的作品……