How to get the resolution of the Camera in QML



  • Hi,

    I am using the Qml Camera element for capturing camera output and using the VideoOutput for diplaying it.
    How can I find the resolution of the Camera in Qml ?



  • @lalvishnu12 According to the documentation, the property resolution holds the resolution/size of the image to be captured. If empty, the system chooses the appropriate resolution.

    + info

    Maybe you could try to get the value of that property when you start the camera.



  • Thanks for the reply.

    But it is showing only QSize(-1,-1) when I console it.



  • @lalvishnu12 Hi,

    I've been working with some examples, and I afraid you must set the resolution or you'll get that size if you request it.

    I suppose you know how to set the resolution, but anyway, here you have a piece of code:

     Camera {
        id: camera
    
        imageCapture {
            onImageCaptured: {
                console.log(vRecorder.resolution)
            }
        }
    
        videoRecorder {
            id: vRecorder
            resolution: "320x240"
            frameRate: 30
        }
    }


  • Thank you for the reply.
    I tried setting the resolution property of the CameraCapture and the console printed the given value. But the resolution of the image captured was in the camera's default resolution.

    I didn't tried it in the VideoRecorder. I will try it.



  • @lalvishnu12 Thanks.

    Let me know if you get any progress.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.