Results 1 to 4 of 4

Thread: Interpolation of data in Qwt Raster Matrix Data

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Interpolation of data in Qwt Raster Matrix Data

    Hi all,

    I am using Qwt Raster Matrix Data to develop spectrogram plot. Data that is used for presenting contours is data from file. Usually, it is the matrix of around 50 - 100 rows and 5 - 20 columns. After attaching it to the Qwt Raster Matrix Data, I use it produce spectrogram using Spectrogram Class. Then I attach spectrogram to Qwt Plot.

    Everything works fine, values of spectrogram are ok. But beacause data used is not very dense, my contour is filled with bunch of rectangulars of different colours. When I use Octave for displaying same data, I get very smooth, "non - pixelised" contours.

    From what I read in documentation of Qwt Raster Matrix Data, it uses by default next neighbour interpolation algorithm. My question is: Am I missing a point here and next neighbour interpolation in QwtRasterMatrixData isn't used for smoothing the contour plot and some seperate algorithm should be used for it?

    Thank you in advance for your answers.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Interpolation of data in Qwt Raster Matrix Data

    Quote Originally Posted by burger_major View Post
    Am I missing a point here and next neighbour interpolation in QwtRasterMatrixData isn't used for smoothing ... ?
    Next neighbour is not interpolating between values by definition: see https://en.wikipedia.org/wiki/Bicubic_interpolation ( the rasterview example shows exactly the data given in the article ).

    There is only one algo implemented, that interpolates between data point: bilinear interpolation ( see QwtMatrixRasterData::BilinearInterpolation ).
    For more advanced methods you would have to overload QwtRasterData::value() and write some code - but this is usually a trade of between performance and the quality of the interpolation.

    Uwe

  3. #3
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Interpolation of data in Qwt Raster Matrix Data

    Uwe,

    Thank you for your reply. According to the article, Bilinear interpolation is what I am looking for, but I have troubles with switching from default nearest neighbour resampling mode to the bilinear interpolation.

    Qt Code:
    1. QVector <double> values;
    2. for(int i=-25; i<25; i++)
    3. {
    4. values.push_back(i*i);
    5. }
    6. QwtMatrixRasterData *m = new QwtMatrixRasterData;
    7. m->setValueMatrix(values,5);
    8. m->setResampleMode(m->BilinearInterpolation);
    To copy to clipboard, switch view to plain text mode 

    changing resample mode in that way doesn't seem to give any changes to data presentation.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Interpolation of data in Qwt Raster Matrix Data

    Quote Originally Posted by burger_major View Post
    ...but I have troubles with switching from default nearest neighbour resampling mode to the bilinear interpolation.
    Check the example.

    Uwe

Similar Threads

  1. Replies: 8
    Last Post: 16th July 2015, 19:44
  2. Replies: 1
    Last Post: 26th November 2013, 20:25
  3. Replies: 4
    Last Post: 29th May 2013, 12:56
  4. Replies: 2
    Last Post: 29th July 2012, 19:09
  5. Replies: 2
    Last Post: 1st April 2012, 16:33

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.