Results 1 to 5 of 5

Thread: Fast Fourier Transform with Qt

  1. #1
    Join Date
    May 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    1

    Default Fast Fourier Transform with Qt

    Hello gurus,
    I'm trying to implement FFT on my Qt program in order to find Fundamental frequencies (spectrum) of a time series..
    So I have a Qvector<double> and i want to obtain some couples: <double,double> (frequency, amplitude).

    Since it is "a bit long" to create the whole library, could you please suggest me some easy one? (and possible some tutorial/explanation on how to use it?)

    thanks guys

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,348
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: Fast Fourier Transform with Qt

    Unless you are writing your own FFT, you probably can't easily use QVector<double> in a routine that expects double pairs. However, if all you need is a pointer to a C++-style array to pass to a library function, then use the QVector::data() method to obtain a double * pointer.

    Most FFT libraries I have seen expect a single double * array of amplitude values and have an implied frequency that starts at zero. (The frequency array is in fact irrelevant in this case - the FFT expects the amplitude array to represent values at equal frequency intervals).

    But maybe I don't understand your question.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Fast Fourier Transform with Qt

    I you do not want to implement your own FFT routine in C or C++ then a couple of FFT libraries with different licenses can be trivially found.

  4. #4
    Join Date
    May 2012
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X
    Thanks
    1

    Default Re: Fast Fourier Transform with Qt

    thanks for your answers,
    also a single double * array may be useful for my purpose, as explained above (right, the frequencies will not be stored in an array because they'll taken at regular intervals).
    I've tried with both FFTW (which I was not able to import) and FFT Kiss, (also FFTReal). But i would like to know (since I'm quite new with Qt programming) if you know a simple tutorial, or a simple program which uses one of them to find the spectrum..
    thanks again

    P.S.: for FFT for example, when i do in my .cpp:
    #include <fftw3.h>
    my class myclass::function
    {
    fftw_complex *in, *out;
    fftw_plan p;
    }

    fftw_plan is not automatically inherited as a type (purple colour)..so no plan can be defined..
    Last edited by giarandrea; 9th May 2012 at 23:02.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Fast Fourier Transform with Qt

    You do realise that this has nothing to do with Qt right? Qt is not a programming language, it is a set of libraries just like FFTW, Kiss FFT, OpenCV and multitudes of others are sets of libraries. C++ is the programming language. You need to understand C++, and the compiler/linker that allow you to create programs from source, before you can do much else. A little bit of effort in understanding now will save you much blind, thrashing about trying to make things work later.

    If your compiler pre-processor cannot find headers you have included then code that depends on them will fail to compile. Note that this is a different thing to your text editor, which purple-ifies code, not being able to find the headers; the two may not agree but the code may still compile. You have assumed the fftw3.h file is in a system default location and that is not the case as far as the text editor is concerned. You have not said if the code compiles or not so I cannot say if the compiler is happy but I would guess it is not.

    All compilers have ways to supplement their include and library search path. Qt's qmake has mechanisms to assist with this in a cross-platform fashion: INCLUDEPATH and LIBS. Qt even has information on how to use third-party libraries with qmake.

Similar Threads

  1. transform() vs pos() for QGraphicsItem
    By aalexei in forum Qt Programming
    Replies: 9
    Last Post: 14th November 2012, 00:34
  2. Transform widget with the mouse
    By puch71 in forum Newbie
    Replies: 1
    Last Post: 31st January 2011, 08:36
  3. Distance Transform on a QImage
    By Franckesh in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2010, 09:58
  4. How to transform image like warp
    By yycking in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2009, 09:35
  5. understanding QwtPlot::transform()
    By b.mourat in forum Qwt
    Replies: 1
    Last Post: 25th May 2008, 08:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.