Results 1 to 9 of 9

Thread: Qwt Interpolation

  1. #1
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Qwt Interpolation

    Hi,

    I am aware that Qwt features bilinear interpolation as a visualisation feature. It looks really nice, especially in array plotting, but can it also be accessed and modified or saved as an array? And can the user specify the number of iterations in the interpolation?

    Thank you.


    Regards,
    Mr_Cloud

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

    Default Re: Qwt Interpolation

    Quote Originally Posted by Mr_Cloud View Post
    I am aware that Qwt features bilinear interpolation as a visualisation feature. It looks really nice, especially in array plotting, but can it also be accessed and modified or saved as an array? And can the user specify the number of iterations in the interpolation?
    You can call QwtMatrixData::value() from application code too and of course you can do with the result whatever you want - f.e to store it in a array.
    But even if the API is not o.k. for you - there is not much mystery behind this algo.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Mr_Cloud (4th July 2012)

  4. #3
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Interpolation

    Quote Originally Posted by Uwe View Post
    You can call QwtMatrixData::value() from application code
    Yes of course, but that just returns values from the input matrix I assigned in the first place. I tried returning the valueMatrix after doing setResampleMode(), but that still has the same matrix values with no interpolation data. If I wish to plot a simple [1,2;3,4] matrix, is the interp data between these points available to the user in Qwt?

    Thanks.


    Regards,
    Mr_Cloud

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

    Default Re: Qwt Interpolation

    Quote Originally Posted by Mr_Cloud View Post
    Yes of course, but that just returns values from the input matrix I assigned in the first place.
    No in BilinearInterpolation mode it interpolates, when you ask for coordinates inside of its bounding rectangle. Qwt is open source - check the code when you don't believe it.

    Uwe

  6. #5
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Interpolation

    Dear Uwe, could you please give a brief example on how to retrieve interpolated data?

    Thanks in advance.


    Regards,
    Mr_Cloud

  7. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt Interpolation

    Qt Code:
    1. double x1 = matrixRasterData.interval( Qt::XAxis ).minValue();
    2. double x2 = matrixRasterData.interval( Qt::XAxis ).maxValue();
    3. double y1 = matrixRasterData.interval( Qt::YAxis ).minValue();
    4. double y2 = matrixRasterData.interval( Qt::YAxis ).maxValue();
    5.  
    6. if ( x2 < x1 )
    7. qSwap( x1, x2 );
    8. if ( y2 < y1 )
    9. qSwap( y1, y2 );
    10.  
    11. const double dx = ( x2 - x1 ) / n;
    12. const double dy = ( y2 - y1 ) / m;
    13.  
    14. for ( double x = x1; x <= x2; x += dx )
    15. {
    16. for ( double y = y1; y <= y2; y += dy )
    17. {
    18. const double valueXY = matrixRasterData( x, y );
    19. ...
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 

    HTH,
    Uwe
    Last edited by Uwe; 4th July 2012 at 07:23.

  8. The following user says thank you to Uwe for this useful post:

    Mr_Cloud (4th July 2012)

  9. #7
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Interpolation

    Brilliant! I see what you mean now Uwe, QwtMatrixData::value() accepts double x and double y as parameters! Thank you, it did help indeed.


    Regards,
    Mr_Cloud

  10. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt Interpolation

    x,y are plot coordinates - not an index for a element of the matrix.

    Uwe

    PS: I have fixed the code snippet in my previous answer - the increments in the loop need to be dx and dy

  11. #9
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Interpolation

    Yep, I realized what you meant and got the code working well. Now I can specify the number of iterations in my output matrix by simply varying dx and dy. Thanks!

Similar Threads

  1. Question about periodic spline interpolation
    By kaidiethelm in forum Qwt
    Replies: 0
    Last Post: 4th June 2012, 13:11
  2. Replies: 3
    Last Post: 23rd February 2011, 07:29
  3. OpenGL Image Tiling Interpolation Problem
    By Halcom in forum Qt Programming
    Replies: 1
    Last Post: 22nd December 2010, 13:41
  4. Replies: 0
    Last Post: 7th March 2010, 13:13
  5. resizing an image without interpolation
    By mattei in forum Qt Programming
    Replies: 3
    Last Post: 9th December 2009, 11:10

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.