Important: Please read the Qt Code of Conduct -

Best way to draw on an RGB24 bitmap from camera and then display on screen ?

  • I'm confused by the array of onscreen and offscreen drawing surfaces and would appreciate some advice.

    Problem1) I want to take the 24bit rgb data from a camera and draw some 2D elements on it (landmark features, groundplane region etc.) There may be quite a lot of landmarks and the video comes in quickly so I want the system to be as fast as possible.

    I have rejected the QGraphicsView/QGraphicsScene route as it seems like overkill. I am thinking of constructing a QImage from the 24bit rgb data provided by the camera using:

    QImage(const uchar * data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void * cleanupInfo = 0)

    When I am ready to draw on the image I think that I should convert it to a QOpenGLFramebufferObject (how??) in order to get hardware acceleration for the drawing. I then need to put the QOpenGLFramebufferObject onto the screen in a QWidget or QGlGraphicsWidget. Alternatively perhaps I should try to put the QImage onto the screen and draw directly on the screen (hopefully with hardware acceleration).

    Problem 2) This is probably not so different from problem 1, but there is no rgb image as a background. I need to construct a 2D image from scratch, which will involve drawing a lot(thousands or tens of thousands) of identical circular blobs + a few other items and then displaying it on the screen. The updates are at video frequencies 10 - 30 fps.

    I imagined using a QGlWidget with some trick to draw a blob at a lot of different positions.

  • Hi, have you ever found a solution to this problem? Seems I am facing the same problem... I need to make it as fast as possible.

Log in to reply