i'm trying dft real 2d matrix using fftw3. code snippet:
size_t nyh = ny/2 + 1; out = (fftw_complex*)fftw_malloc ( sizeof ( fftw_complex ) * nx * nyh ); plan_forward = fftw_plan_dft_r2c_2d ( nx, ny, in, out, fftw_estimate ); fftw_execute ( plan_forward ); where in double* each value @ order of e-270.
my problem out contains -nan values.
is there trick correct values?
thank you
thank everybody.
the problem running in not due fftw3 library , code correct despite of it's weakness.
my problem came input feed fftw_plan_dft_r2c_2d function issued cv::mat image. so, post error did getting trouble:)
i convert cv::mat vector<vector<double> > using function:
static matrixofdouble _convertmat( cv::mat& inmat) { matrixofdouble result; (int = 0; < inmat.rows; ++i) { std::vector<double> row; (int j = 0; j < inmat.cols; ++j) { row.push_back(inmat.at<double>(i, j)); } result.push_back(row); } return result; } and liniarize returned matrix feed dft function.
but of result matrix elements nan.
as fix, cv::mat element long instead of double:
row.push_back(inmat.at<long>(i, j)); good luck trying solve issue.
Comments
Post a Comment