Qt World Summit: Submit your Presentation

Problem of setting camera resolution

  • Hi,
    I'm new to qt and trying to write an monitor application. In my application, I need to grab frames from camera and send frame information to c++ and do some processing. I use QAbstractVideoFilter to do with it. In my application, I need to use two Camera at two different pages. When I use only one camera, all things work well. However, when I add another camera to the application, the resolution of original camera changes. I want my camera videoview displays properly in a 640480 rectangle, so I set viewfinder.resolution to 640480. After adding another camera, I still set viewfinder.resolution to 640*480, however, the size of videoview changes. I print out the video frame size I get in c++, it is 1920 * 1080, not 640 * 480. I searched for the document, then I found the following sentence:
    If the camera is used to capture videos or images, the viewfinder resolution might be ignored if it conflicts with the capture resolution.

    I'm not sure if this is the reason causing my problem, but I don't know how to set capture resolution in my condition...

    following is my camera code:


        id: camera
        viewfinder.resolution: Qt.size( 640, 480 );
        onCameraStateChanged: {
            if( cameraState == Camera.ActiveState ){
                viewfinder.resolution = Qt.size( 640, 480 )
            console.log("camera1 resolution = " + viewfinder.resolution.width + " " + viewfinder.resolution.height )  //this place will print 640*480

    Thanks very much!

  • Hope this might help

     QImageEncoderSettings ies;

Log in to reply