QGraphicsView for full HD picture rendering



  • Hi all,

    As explained a bit in this thread, I'm implementing a widget which:

    • displays full HD pictures from raw pgm-like data;
    • adds reticle-like objects on top of the picture, where zones of interests have been identified.

    The pictures are grayscaled 2048x1088, mostly black and the regions of interest are the white parts. Each picture comes with the meta-data needed to draw the reticle-like objects at high rate. I am using the QGraphics View Framework to do the rendering of my scene. The picture is a QGraphicsPixmapItem, which is periodically refreshed (my target is ~60 Hz). I am concerned about the fact that I am changing the whole QGraphicsPixmapItem at each update, even if the picture doesn't change much, which can impact the overall refresh rate of my application on some machines. I must again precise I'm not using OpenGL viewport.

    So my question is: since I know where are the zones of interest (typically between 3 and 16), is it worth the effort to extract those from the pixmap, and display them on a black background and not displaying the total QGraphicsPixmapItem?

    I'm targetting windows and linux platforms, both 32 and 64 bits using Qt 5.6.

    Thanks in advance


  • Moderators

    @JohanSolo
    Are you zooming/scaling in your graphics view?

    It's definitely worth to just extract the visible regions and render them. For this you can subclass QGraphicsPixmapItem's paint() method. In there all the transformations you made on the item itself are already applied to the passed QPainter (see QPainter::transform()).
    This approach is tricky and becomes really tricky when you start to rotate the items.

    But i am not aware of another approach to gain performance when using QGraphicsPixmapItem with large pixmaps.



  • Thank you for your input!

    @raven-worx said:

    Are you zooming/scaling in your graphics view?

    I can zoom in my graphics view, yes.

    @raven-worx said:

    It's definitely worth to just extract the visible regions and render them. For this you can subclass QGraphicsPixmapItem's paint() method. In there all the transformations you made on the item itself are already applied to the passed QPainter (see QPainter::transform()).
    This approach is tricky and becomes really tricky when you start to rotate the items.

    Lucky me, I'm not rotating anything!

    I was more thinking about creating smaller QGraphicsPixmapItems and adding them to the scene, but your approach seems cleaner.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.