在这边文章中已完成了正向变换,使用idft()实现逆变换;
大致流程如下:
1、读取图像,获取最佳尺寸,快速傅里叶变换要求为2的N次方
2、以0为边缘填充图像;
3、为原图像增加一个通道,进行傅里叶变换;
4、分离通道,获取幅度图像,交叉替换 四分之一区域;
5、copy一份用于逆变换,idft-->分离channel,归一化;
6、log处理dft变换后的图像,方便查看;
代码如下:
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
static void help(char* progName)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (DFT). " << endl
<< "The dft of an image is taken and it's power spectrum is displayed." << endl
<< "Usage:" << endl
<< progName &l