Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. how to take more than one photo in QML?
Qt 6.11 is out! See what's new in the release blog

how to take more than one photo in QML?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 431 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vinaygopal
    wrote on last edited by
    #1

    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)
                        }
                    }
                }
            }
    
        }
    }
    

    }

    ODБOïO 1 Reply Last reply
    0
    • V vinaygopal

      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)
                          }
                      }
                  }
              }
      
          }
      }
      

      }

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      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)
                          }
                      }
                  }
      
      
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved