如何执行FFT2D(快速傅里叶变换2D) R, G, B颜色分量
How to perform FFT2D (Fast Fourier Transform 2D) R, G, B color component
我是快速傅里叶变换(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/0521750334FFT,辛普森法则,傅立叶算法应该都在那里。我读过一位名叫拉贾拉姆的作家的作品……
相关文章:
- 2D数组来自文本输入,中间有空格
- 将值指定给向量(2D)的向量中的某个位置
- 如何使用用户输入在C++中正确填充2D数组
- 如何在C++中检查2D数组中负值的输入验证
- 当我在main中声明了我的2d数组时,为什么我的程序会退出
- 在 2D 向量中使用第三个 [ ] 有什么意义?
- 四边形的 2D 旋转
- 打印第二列时的2d字符矢量打印空间
- 如何将以逗号和空格分隔的整数读取到 2D 数组中?
- 如何在C++函数中声明静态 2D 数组?
- 我是 C++ 的初学者,我想知道如何在 2D 矢量中获取重复值
- 如何声明一个可以在整个程序中使用的全局 2d 3d 4d .. 数组(堆版本)变量?
- opengl glBegin(GL_LINES) 和 glBegin(GL_POINT) 在 2D 中不可视化点矢量
- 在C++中迭代 2D 容器的最干净方法
- 如何引用 2D 指针?
- 如何在 C++ 中使用它的构造函数初始化 unique_ptrs 的 2D 向量?
- C++动态安全 2D 交错阵列
- 如何在C++或OpenCV子矩阵中的2D子向量上使用OpenACC?
- 我已经阅读了很多关于 2d 数组的信息,但我在作业中使用它时遇到了麻烦
- 如何执行FFT2D(快速傅里叶变换2D) R, G, B颜色分量