如何在QML中拍摄多张照片?

我必须使用QML中的网络摄像头拍摄4张连续照片,之后我只能拍摄一张照片 我从QML调试器收到一个错误,指出“相机未准备好捕获”,第一次捕获后如何使相机处于就绪状态,这是我尝试过的代码 即使我将ready状态设置为true:它似乎也不起作用?有什么简单的方法可以解决这个问题吗?

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    Rectangle{
        width: parent.width
        height: parent.height
        ColumnLayout{
            width: parent.width;height: parent.height
            spacing: 15;
            Camera{
                id:cam
                captureMode: Camera.CaptureStillImage
                imageCapture {
                    onImageCaptured: {
                         ready:true
                        console.log(ready)
                    }

            }
            }
            VideoOutput{
                id:vid1
                source: cam
                height:parent.height
                width: 800
                Layout.fillWidth: true
                Layout.fillHeight: true

            }
            Rectangle{
                id:rect1
                width: 100
                height: 30
                Layout.fillWidth: true
                Layout.alignment:bottom
                color: "#365688"
                Text {
                    id: text1
                    anchors.centerIn: parent
                    text:"capture"
                    font.pointSize: 10
                }
                MouseArea{
                    anchors.fill:parent
                    onClicked: {
                        console.log("clicked");
                     for(var i=0;i<=3;i++){
                        cam.start()
                        cam.imageCapture.captureToLocation("C:/Users/vinay/Documents")
                        console.log(cam.cameraStatus)
                        }
                    }
                }
            }

        }
    }
}
lunatic999 回答:如何在QML中拍摄多张照片?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3161913.html

大家都在问