Qt World Summit: Register Today!

Qt 5.7 QCamera input with OpenGLWidget ouput (video pipeline experts needed)

  • Hello,

    I just came from a Directx 9 and 11 project with a camera input. I grabbed the D3D11Texture2D and used that as it is in the GPU still and processed the frame with shaders depending on user desires and got to DrawIndexed. So the incoming frames were on a thread pool from IMFSourceReaderCallback::OnReadSample. All of this was still in D3D11. Now that the frame is processed, it need to be given to the Gui side and onto the render thread. So WPF was stuck in D3D9 and the D3D9Texture2D has the ability to use the backbuffer and write to it. So I took the processed D3D11 texture and pushed it onto the D3D9 backbuffer GUI visible image.

    So now present day. I am on Linux using Qt for the first time. I have heard a lot about Qt on Linux and am excited to be here. It took me time figuring the above Windows video path. I'm hoping to ask for help this time.

    I have seen that the QCamera class needs a ViewFinder from one of three choices.

    void 	setViewfinder(QVideoWidget *viewfinder)
    void 	setViewfinder(QGraphicsVideoItem *viewfinder)
    void 	setViewfinder(QAbstractVideoSurface *surface)

    Now I still want to do image processing and have seen that Qt is ingrained with OpenGL which is very much like Directx. So this is the playground I want to stay in. I need to figure a way to get the three options that the Camera wants to a surface/buffer/texture in OpenGL. Zero copy is obviously an important thing as I will be performing this same very task with (no joking) three camera input streams all going on at once and always on as this product is all about those cameras. I will also have those three streams going out as well to a secondary machine/application. So maximizing processing power is of the highest concern.

    So with all of this said, I'm right now hoping to get a pointer or two on how to move the image from the QCamera to OpenGL with zero copies if possible. Please and thank you ahead of time. Have a great day.


  • Bump...how do I move the video frame from QCamera to OpenGL something?

  • Lifetime Qt Champion


    What kind of camera are you going to connect to ? Are they already supported by GStreamer ?