fftw 计算不准确

发布于 2024-12-07 23:11:24 字数 879 浏览 2 评论 0原文

我正在使用 FFTW 库计算像素为双倍的图像的 fft,为此目的,我在 Visual Studio 2008 中使用库 fftw(http://www.fftw.org/) 库并使用 ITK (http://www.fftw.org/) /www.itk.org/)。

当我使用“fftw_plan_dft_c2r_2d”方法从双指针计算 fft 时,它进行了计算,但引入了不准确度,约为 +- 0.5…

我真的不知道出了什么问题,也许是像素之间的间距?使用的数据类型?以前有人遇到过这个问题或类似的问题吗?

非常感谢。

Antonio

代码:

代码在这里:

// 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
    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 

我想对名为 f1 的双指针进行 FFT。

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
    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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文