基础知识
复数表示
C = R + jI
极坐标:C = |C|(cosθ + jsinθ)
欧拉公式:C = |C|ejθ
有关更多的时域与复频域的知识可以学习复变函数与积分变换,本篇文章只给出DFT公式,性质,以及实现方法
二维离散傅里叶变换(DFT)
其中f(x,y)为原图像,F(u,v)为傅里叶变换以后的结果,根据欧拉公式可得,每个F(u,v)值都为复数,由实部和虚部组成
代码示例
1 void dft(short** in_array, double** re_array, double** im_array, long height, long width) 2 { 3 double re, im, temp; 4 5 for (int i = 0; i < height; i++){ 6 for (int j = 0; j < width; j++){ 7 re = 0; 8 im = 0; 9 10 for (int x = 0; x < height; x++){ 11 for (int y = 0; y < width; y++){ 12 temp = (double)i * x / (double)height + 13 (double)j * y / (double)width; 14 re += in_array[x][y] * cos(-