开发者

Inaccuracy in fftw calculation

开发者 https://www.devze.com 2023-04-11 03:19 出处:网络
I am calculating the fft of an image which pixels are double with the FFTW library, for that purpose i am using the library fftw(http://www.fftw.org/) library in Visual Studio 2008 and using ITK (http

I am calculating the fft of an image which pixels are double with the FFTW library, for that purpose i am using the library fftw(http://www.fftw.org/) library in Visual Studio 2008 and using ITK (http://www.itk.org/).

When I calculate the fft from a double pointer, with the method ‘fftw_plan_dft_c2r_2d’, it makes the calculation but introducing inaccuracy, it is around +- 0.5…

I don’t really know what is wrong, maybe the spacing between pixels? The type of the data used? Did someone have this problem or something similar before?

Many thanks in advanced.

Antonio

CODE:

The code is here:

// FFT CALCULATION
    // Inizialization of the neccesary elemnets for calculating the FFT. 
    fftw_plan p1;  //variable for storing the FFT 
    int N_fft= ancho*alto;  //number of points of the image开发者_JAVA百科
    fftw_complex *F1 =(fftw_complex*) fftw_malloc(sizeof(fftw_complex)*alto*((ancho/2)+1));  // result pointer
    p1 = fftw_plan_dft_r2c_2d(alto,ancho, f1, F1, FFTW_ESTIMATE);  // FFT planning
    fftw_execute(p1);  // FFT calculation
    fftw_destroy_plan(p1); // plan is destroyed 

I want to do the FFT to double pointer called f1.

0

精彩评论

暂无评论...
验证码 换一张
取 消