0

I'm building an app which uses Qt5 that aims to display a video from a digital camera (using Gstramer pipeline). Then with the help of QPainter I'm drawing some graphics on top of it (some text shapes, and icons).

The thing is that the video refresh rate is ~30 FPS, and I only need to update the graphics in ~10 FPS or so. Currently I redraw the graphics overlay for every video frame which is very wasteful in terms of CPU.

Is there a better approach in which I can re-use the overlay from the previous frame, and only update the background (the frame from the camera)?

One idea that I had was to paint the overlay into a QImage, and then just paint the image onto the QOpenGLWidget, but it just feels wrong.

Thank you...

Omer
  • 456
  • 1
  • 3
  • 19
  • 2
    Why does drawing to an image and then overlaying that image feel wrong? Seems quite reasonable to me. – G.M. Dec 12 '21 at 14:24
  • I was thinking more like creating another widget on top of the QOpenGLWidget, and draw on top of it. I wanted to separate the drawing from the video and have them in two different layers. Just not sure it's possible in Qt or how it may be done. – Omer Dec 12 '21 at 14:46
  • @G.M. Will using QGraphicsView and QGraphicsItems be more efficient in that sense? – Omer Dec 14 '21 at 17:02

0 Answers0