FFTW庫+VS2012配置

來源:互聯網
上載者:User

標籤:des   style   blog   http   使用   os   io   檔案   

       配置環境:Windows7+VS2012


      下載資源套件,解壓後如:

       

       要嵌入VS2012中,需要對應的lib檔案,於是接下來使用VS2012來產生對應的lib檔案

       在VS2012/Common7/IDE檔案夾中找到四個檔案如下:

     

       將這四個檔案放到VS2012/VC/bin檔案夾中:

       在cmd操作如下:

       

      出現以上情況時,表示lib.exe可以正常運行

      輸入以下命令:

     lib /machine:i386 /def:libfftw3-3.def
     lib /machine:i386 /def:libfftw3f-3.def
     lib /machine:i386 /def:libfftw3l-3.def

    就產生了對應的lib檔案

   

    將以上的檔案分別放入VS2012安裝目錄中,fftw3.h放入include檔案夾,對應的lib檔案放入lib檔案夾中,dll檔案放入windows/system32檔案夾中,配置完成。

     接下來測試FFTW庫:

     在VS2012中建立一個工程:

    包含標頭檔如下:

#include "stdafx.h"#include "fftw3.h"  #include "iostream"#include <stdio.h>#include <stdlib.h>#include <string.h>#include "opencv.hpp"using namespace cv;using namespace std;

     添加完成後,抄一段代碼如下:

void test2(){fftw_complex *in, *out;  fftw_plan p;  int N= 8;  int i;  int j;  in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);  out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);  for( i=0; i < N; i++)  {  in[i][0] = 1.0;  in[i][1] = 0.0;  printf("%6.2f ",in[i][0]);  }  printf("\n");  p=fftw_plan_dft_1d(N,in,out, FFTW_FORWARD, FFTW_ESTIMATE);  fftw_execute(p); for(j = 0;j < N;j++)  {  printf("%6.2f ",out[j][0]);  }  printf("\n");  fftw_destroy_plan(p);  fftw_free(in);   fftw_free(out);  system("pause");}int main()  {  test2();system("pause");return 0;  }  

    測試結果如下:



   對映像的fft操作測試如下:

   


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.