Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. 2D Spectrogram with FFTW and QT.
Forum Updated to NodeBB v4.3 + New Features

2D Spectrogram with FFTW and QT.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I am developing an application for audio processing in real time.

    I used the FFTW library to build a NxM matrix representing the spectrogram of the recorded signal.

    My idea now is to represent graphically the spectrogram . At first I tried it with QWT but is too slow and I need to make the process faster as it is in real time.

    Another solution has been to use a QImage object.

    @ imageToShow(width, high, QImage::Format_Indexed8)@

    I implemented a method :

    @int MatrixPlotter::DefineDataToPlot(int width, int high,std::vector< std::vector<unsigned int> > data){
    if(this->width!=width || this->high!=high){
    return ERROR;
    }else{
    for(int i=0;i<this->width;i++){
    for(int j=0;j<this->high;j++){
    this->imageToShow.setPixel(i,j,data[i][j]);
    }
    }
    return READY;
    }
    }@

    For each pixel of the image I assign a value of NxM matrix. To do this previously , I make a change to the " double" values ​​NxM matrix on a scale from 0-255 (unsigned int) .

    The system works well but I have a problem and it is relatively slow. If the FFT size is very large tends to introduce delays .

    I thought implement it using the OpenGL library. I need help to learn how to do it.

    Does anyone could advise a more efficient method? Are there any alternatives for implementation?

    My level of English is limited. I hope I have expressed myself correctly. Thank you very much.

    1 Reply Last reply
    0
    • U Offline
      U Offline
      uwer
      wrote on last edited by
      #2

      When going with Qwt image composition from data on my box ( i5 qudcore ) takes about ~50ms ( ~ 1800x1000 pixels ).
      But iterating about a widget of 1000x1000 pixels is always something that takes some time.

      Concerning your loop: using setPixel() is slow as you recalculate the position in the buffer for each pixel ( a million times ). Better use a ptr iterating over each scan line ( or use Qwt that does this all + multithreaded for you ).

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        [quote author="uwer" date="1422975543"]When going with Qwt image composition from data on my box ( i5 qudcore ) takes about ~50ms ( ~ 1800x1000 pixels ).
        But iterating about a widget of 1000x1000 pixels is always something that takes some time.

        Concerning your loop: using setPixel() is slow as you recalculate the position in the buffer for each pixel ( a million times ). Better use a ptr iterating over each scan line ( or use Qwt that does this all + multithreaded for you ).

        [/quote]

        I work with images of a 500x80 or 500x200 size , a very small size. When implemented in QWT takes about 3 s . I guess I have not implemented correctly .

        How did you implemented ? Could you share the code ?

        Thank you very much for responding.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved