Results 1 to 4 of 4

Thread: QImage vs QPixmap the eternal dilemma of good drawing performance on linux

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default QImage vs QPixmap the eternal dilemma of good drawing performance on linux

    So some background information about my problem. I have a program which displays images coming from webcam. The program works just fine, but the frame rate never reaches anywhere near the 30 which is coming from the camera. I have pinpointed the issue and it is with converting QVideoFrame to QImage and then drawing the image. On windows this code works fine and the whole drawing process takes about 2ms. On linux it's completely different story, drawing the QImage takes more than 20ms which may not sound like much but when it's added for every frame the framerate drops to half of what it should be.

    Now i know drawing QImages is slow on linux environments from doing some research but i have no clue how to convert the QVideoFrame straight to QPixmap which is faster to draw. Using QPixmap::fromImage() is not viable solution because that is slow as well.

    Current implementation for drawing the image coming from the webcam.

    Qt Code:
    1. if(mVFcurrentFrame.map(QAbstractVideoBuffer::ReadOnly))
    2. {
    3. QImage image(mVFcurrentFrame.bits(), mVFcurrentFrame.width(), mVFcurrentFrame.height(), mVFcurrentFrame.bytesPerLine(), imageFormat);
    4. painter->drawImage(0,0,image); //Takes about 20ms
    5. mVFcurrentFrame.unmap();
    6. }
    To copy to clipboard, switch view to plain text mode 

    So my questions are:

    Is it possible to convert QVideoFrame straight to QPixmap and would it be a viable solution?

    Is there some other way i could speed up the drawing process?
    Last edited by MidWay; 13th May 2014 at 09:54.

Similar Threads

  1. Replies: 0
    Last Post: 8th May 2009, 12:37
  2. Replies: 4
    Last Post: 8th May 2009, 12:04
  3. drawing on a QPixmap or QImage
    By gren15 in forum Newbie
    Replies: 15
    Last Post: 3rd March 2009, 17:48
  4. Replies: 4
    Last Post: 28th August 2008, 13:13
  5. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11

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.