#include <iostream>
#include "Eigen/Dense"
#include <opencv2/core/eigen.hpp>
#include "fftw3.h"
using namespace std;
using namespace Eigen;
int main() {
MatrixXd a(3, 4), out(a.rows(), a.cols());
MatrixXcd FTa(a.rows() / 2 + 1, a.cols());
a << 0, 2, 4, 1,
6, 1, 3, 2,
5, 7, 4, 3;
fftw_plan P;
P = fftw_plan_dft_r2c_2d(a.cols(), a.rows(), a.data(), (fftw_complex*)FTa.data(), FFTW_ESTIMATE);
fftw_execute(P);
cout << FTa << endl;
cout << endl;
P = fftw_plan_dft_c2r_2d(a.cols(), a.rows(), (fftw_complex*)FTa.data(), out.data(), FFTW_ESTIMATE);
fftw_execute(P);
out = out / (a.cols() * a.rows());
cout << out << endl;
return 0;
};
a 与 out 输出一致