Results 1 to 2 of 2

Thread: slow ui.cameraView->setPixmap(QPixmap::fromImage(img));

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2012
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default slow ui.cameraView->setPixmap(QPixmap::fromImage(img));

    Hi

    Working with Qt 4.6.3 on an embedded system. Get some data from camera sensor
    and saved in a QByteArray frame. Due to image format differences I convert the
    data into a QImage img which is using the following for rendering onto a QLabel.
    ui.cameraView->setPixmap(QPixmap::fromImage(img));

    When I time this last line of code, for large resolution (640x480) it is very slow
    and limit the performance severely in terms of fps (frame-per-second).

    Are there any tricks / ways in Qt to accelerate this rendering aspect ?

    Thank you very much in advance for your time and help.

    Brahim

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: slow ui.cameraView->setPixmap(QPixmap::fromImage(img));

    I don't know why that is, but one thing that I would check is that the QImage and that system's QPixmap are in the same format. If they are not, perhaps you could construct your QImage to the label's format, thus skipping a need for format conversion. Another thing could scaling. If your QImage is not the same size as the label and setPixmap does the scaling, you could perhaps use a faster scaling routine, or create the QImage exactly to the desired size (if it is 1 pixel row off, there might be resampling...).

Similar Threads

  1. QGraphicsPixmapItem::setPixmap() renders very slow
    By hakiim35 in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2011, 13:38
  2. Replies: 6
    Last Post: 25th August 2009, 21:50
  3. setPixmap
    By mgurbuz in forum Qt Programming
    Replies: 9
    Last Post: 13th July 2007, 13:37
  4. Replies: 5
    Last Post: 9th April 2007, 14:26
  5. QPixmap::grabWindow too slow
    By niko in forum Newbie
    Replies: 2
    Last Post: 31st August 2006, 06:40

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.