Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QGraphicsView for full HD picture rendering

    General and Desktop
    qgraphicsview
    2
    3
    1128
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JohanSolo
      JohanSolo last edited by JohanSolo

      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

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @JohanSolo last edited by raven-worx

        @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.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • JohanSolo
          JohanSolo last edited by JohanSolo

          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.

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          1 Reply Last reply Reply Quote 0
          • First post
            Last post