Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get Raw image frame data (RGB) from webcamera (Webcam)



  • Hi,
    Im doing a webstream demo application in desktop, hence I am using QT widgets (and not QML).
    I am learning on how to make QCamera work and I have made it work.

    Now I want to get the RGB image of the camera, so I can compress it using our own compression algorithm and send it to network using our own protocol.

    I want to do it explicitly as well so I can control the timing of capture (to prevent delay and timing issue).

    Most of the samples I see online is it captures image and dump to file.

    1. How can I do it? Capture the raw RGB image of the camera explicitly (manual triggered).
      Example
      rgbimage = capture()
      c = compress(rgb)
      sendToNetwork(c)
      rgbimage = capture();

    on the above pseudocode, i only capture the frame when processing is done so I can only capture fresh frame instead. That is the reason I want to manualy capture it instead of a callback trigger from the camera.

    Im using MediaWIdgets stuff like QCamera and QCameraViewFinder.
    I cant find a sample to do it, most captures and dump to a file.

    Thank you in advance!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    For that level of control, you will have to go lower level that what QCamera proposes. You also have to take into account that not all camera provides RGB data.

    In your case maybe OpenCV will be a better fit for that part of your code.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    For that level of control, you will have to go lower level that what QCamera proposes. You also have to take into account that not all camera provides RGB data.

    In your case maybe OpenCV will be a better fit for that part of your code.


Log in to reply