Results 1 to 9 of 9

Thread: Qwt Plot using an image as background reference

  1. #1
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qwt Plot using an image as background reference

    Hi all,
    I'm french so excuse me for my English.

    I have some problem on qwt, I generate a lot of graphics (polar graphics particulary) and save them as image (8000 images) so it take many time.
    I want to use an image (of the curve are already same on 8000 images) for the background.

    Does anyone have an idea ?
    I see about canvas but I don't arrived to use it.

    An example in image :
    Lidar.png------->00001Lidar.png
    Thank you for attention
    Kind regards,
    Tinou
    Attached Images Attached Images
    Last edited by Tinou[FR]; 28th April 2012 at 13:33.

  2. #2
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Plot using an image as background reference

    Any idea ?

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,326
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 880 Times in 828 Posts

    Default Re: Qwt Plot using an image as background reference

    Quote Originally Posted by Tinou[FR] View Post
    I want to use an image (of the curve are already same on 8000 images) for the background.
    Well you could always load an image - assuming you are talking about some raster graphic format - as spectrogram, but in your case I wouldn't even spend a second on trying it. Scaling the antialiased lines from your image from your screenshot will result in in something horrible.

    If you can't vectorize your images you should try to find out how they were calculated. When there is some mathematics behind the 8000 plots - maybe it is not so much work to show them as a regular curve.

    Uwe

  4. #4
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Plot using an image as background reference

    Hi,
    Thank you for reply.
    I foud a solution here my code :

    QImage img;
    img.load(imgPath+"/Lidar.png");
    qDebug() << img.size();
    QBrush qbrush(img);
    qbrush.setTextureImage(img);
    qDebug() << "Taille" << qbrush.textureImage().size();

    polarPlot->setPlotBackground(qbrush);


    Here the result :
    Image use for Background --------> Background --------> Image
    Lidar.png-------->Lidar2.png-------->00001Lidar.png
    But the problem is the brush is resize and I don"t know why, have you an idea?
    Regards,
    Tinou
    Last edited by Tinou[FR]; 2nd May 2012 at 10:20.

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

    Default Re: Qwt Plot using an image as background reference

    As said before: the idea itself is not a good one and I don't want to spend time on assisting you in running in the wrong direction.

    Uwe

  6. #6
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Plot using an image as background reference

    Ok then I will try to found an other way. Thanks

    Is that possible to attach an Item one time for all 8000 time?


    EDIT : Ok then I have wrong since the beginning !!
    It's not the "attach" who take time but the renderer as an image, any idea how optimise this??
    Last edited by Tinou[FR]; 2nd May 2012 at 10:42.

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

    Default Re: Qwt Plot using an image as background reference

    Ah o.k. - maybe now I got what you want.

    Qt Code:
    1. class YourCurve: public QwtPolarCurve
    2. {
    3. ...
    4. virtual void draw( QPainter *painter,
    5. const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
    6. const QPointF &pole, double radius,
    7. const QRectF &canvasRect ) const
    8. {
    9. if ( ( canvasRect.size() != m_image.size() ) || other_conditions_to_invalidate_the_image() )
    10. {
    11. m_image = QImage( canvasRect.size(), QImage::Format_ARGB32_Premultiplied );
    12. m_image.fill( 0 );
    13.  
    14. QPainter p( &m_image );
    15. p.translate( -canvasRect.topLeft() );
    16. QwtPloarCurve::draw( &p, azimuthMap, radialMap, pole, radius, canvasRect );
    17. }
    18.  
    19. painter->drawImage( canvasRect.topLeft(), m_image );
    20. }
    21.  
    22. QImage m_image;
    23. };
    To copy to clipboard, switch view to plain text mode 

    };

  8. #8
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Plot using an image as background reference

    I'm trying to understand, is that a surcharge of the function draw to set the result in a Qimage?
    The objective is to make a video from the 8000 image so I think to render temporary the image in a QImage or something else but I used a Qprocess (with mencoder) for the video so I need real images.
    I don't no other way.
    Clearly is that possible to render plot in a Qimage or something else and make a video, with what?

    Thank you again for reply

  9. #9
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Plot using an image as background reference

    Hi all,
    I'm sorry for the double post, but does anyone now how to reduce or optimise the renderer function ?
    OR
    How to create a video from the plot without save as file the image.

Similar Threads

  1. Replies: 0
    Last Post: 5th April 2011, 13:36
  2. Plot Raster chart background
    By jmsbc in forum Qwt
    Replies: 3
    Last Post: 8th August 2010, 19:56
  3. Replies: 1
    Last Post: 25th June 2010, 18:31
  4. Replies: 3
    Last Post: 9th September 2009, 04:34
  5. Replies: 2
    Last Post: 30th June 2009, 17:08

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.