how to take more than one photo in QML?
-
I have to take 4 continues pictures using the webcamera in QML i can take only one picture after that I get an error from the QML debugger which states "Camera not ready for capture" how do i get the camera to be in ready state after the first capture this is the code i have tried even if i set the ready state to true: it does not seem to be working? is there an easy way to get my way around this?
#QML #Camera
code tried:
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) } } } } } }
}
-
hi
@vinaygopal said in how to take more than one photo in QML?: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) } } }
the for loop might be the issue,
please try without it, and click 3 times the button to see if it will work.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) } } }