Important: Please read the Qt Code of Conduct -

How to use QML Camera image in c++ code

  • How can I access image captured by QML Camera element in c++ code ?
    I want to capture an image using qml camera element, change it in some way using c++ and then display it to the user, but I can't find the way to do this.

    Any help appreciated :)

  • This should be possible. After you take a picture, call a method in C++ ( expose a method or class instance from C++). Once you are done with your C++ code, raise a signal and catch it inside QML. I don't see whey this should not be possible?

  • Hi,

    From what I understand the Camera element will save the image to a file, which you should then be able to manipulate. Maybe something like the following?

    Camera {
    onImageCaptured : {
    // pass the preview URL to a processImage function exposed from C++

    You'd then need to expose the manipulated image back to QML (either as a URL for a saved file, or using QDeclarativeImageProvider) for display.

    If you aren't real familiar with the ways QML and C++ can communicate with each other, provides a great reference.


  • I want to process every frame of the camera video, how to do that @mbrasser.

Log in to reply