Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML Camera Flash not working properly (Android, iOS)
Forum Updated to NodeBB v4.3 + New Features

QML Camera Flash not working properly (Android, iOS)

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 1.2k Views 2 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.
  • ekkescornerE Offline
    ekkescornerE Offline
    ekkescorner
    Qt Champions 2016
    wrote on last edited by
    #1

    trying to use QML Camera in Android / iOS App
    run into a problem with the Flash

    Flash Modes Auto, On, Off, FlashVideoLight are supported by my devices
    Setting FlashAuto or FlashOn I can see that the Flash indeed was used from Android or iOS Camera
    but captured Image is dark. seems not to be in sync with Flash and captured too early

    anyone else run into this ?
    as a workaround I can use FlashVideoLight and set it immediately before Image capture:

    // on clicked Capture Button:
    camera.flash.mode = Camera.FlashVideoLight
    flashTimer.start()
    ....
    Timer {
        id: flashTimer
        repeat: false
        interval: 200
        onTriggered: {
            camera.searchAndLock()
            camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation())
        }
    }
    ....
    Camera {
        imageCapture {
            onImageCaptured: {
                camera.unlock()
                camera.flash.mode = Camera.FlashAuto
                photoPreview.source = preview  // Show the preview in an Image
            }
            onImageSaved: {
                console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath)
            }
        }
    }
    

    works but is an ugly workaround
    any ideas or should I open a Bug report ?

    ekke ... Qt Champion 2016 | 2024 ... mobile business apps
    5.15 --> 6.9 https://t1p.de/ekkeChecklist
    QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

    1 Reply Last reply
    0
    • SGaistS SGaist

      Hi,

      Looks like a bug.

      What version of Qt are you using ?
      Could you try that on different Android/iOS versions ?

      ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote on last edited by ekkescorner
      #3

      @SGaist Qt 5.10.1, tried with iOS 11, Android 6, Android 7 on different devices
      now found a Bug explaining why this happens: https://bugreports.qt.io/browse/QTBUG-37990

      so the solution to fix this is:

      // Capture Button:
              camera.searchAndLock()
              camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation())
      //
      Camera {
              id: camera
              captureMode: Camera.CaptureStillImage
              flash.mode: Camera.FlashAuto
              imageCapture {
                  onImageCaptured: {
                      camera.unlock()
                      // Show the preview in an Image
                      photoPreview.source = preview
                  }
                  onImageSaved: {
                      console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath)
                      // Hint: you should set the Image with the saved Image,
                      // because if using a Flash the first preview will be too dark
                      // see https://bugreports.qt.io/browse/QTBUG-37990
                      photoPreview.source = "file://"+ camera.imageCapture.capturedImagePath
                  }
              }
          } // camera
      

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.9 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      NianoniaaN 1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Looks like a bug.

        What version of Qt are you using ?
        Could you try that on different Android/iOS versions ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        ekkescornerE 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Looks like a bug.

          What version of Qt are you using ?
          Could you try that on different Android/iOS versions ?

          ekkescornerE Offline
          ekkescornerE Offline
          ekkescorner
          Qt Champions 2016
          wrote on last edited by ekkescorner
          #3

          @SGaist Qt 5.10.1, tried with iOS 11, Android 6, Android 7 on different devices
          now found a Bug explaining why this happens: https://bugreports.qt.io/browse/QTBUG-37990

          so the solution to fix this is:

          // Capture Button:
                  camera.searchAndLock()
                  camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation())
          //
          Camera {
                  id: camera
                  captureMode: Camera.CaptureStillImage
                  flash.mode: Camera.FlashAuto
                  imageCapture {
                      onImageCaptured: {
                          camera.unlock()
                          // Show the preview in an Image
                          photoPreview.source = preview
                      }
                      onImageSaved: {
                          console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath)
                          // Hint: you should set the Image with the saved Image,
                          // because if using a Flash the first preview will be too dark
                          // see https://bugreports.qt.io/browse/QTBUG-37990
                          photoPreview.source = "file://"+ camera.imageCapture.capturedImagePath
                      }
                  }
              } // camera
          

          ekke ... Qt Champion 2016 | 2024 ... mobile business apps
          5.15 --> 6.9 https://t1p.de/ekkeChecklist
          QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

          NianoniaaN 1 Reply Last reply
          2
          • ekkescornerE ekkescorner

            @SGaist Qt 5.10.1, tried with iOS 11, Android 6, Android 7 on different devices
            now found a Bug explaining why this happens: https://bugreports.qt.io/browse/QTBUG-37990

            so the solution to fix this is:

            // Capture Button:
                    camera.searchAndLock()
                    camera.imageCapture.captureToLocation(dataUtil.capturedPhotoLocation())
            //
            Camera {
                    id: camera
                    captureMode: Camera.CaptureStillImage
                    flash.mode: Camera.FlashAuto
                    imageCapture {
                        onImageCaptured: {
                            camera.unlock()
                            // Show the preview in an Image
                            photoPreview.source = preview
                        }
                        onImageSaved: {
                            console.log("SAVED PATH: "+camera.imageCapture.capturedImagePath)
                            // Hint: you should set the Image with the saved Image,
                            // because if using a Flash the first preview will be too dark
                            // see https://bugreports.qt.io/browse/QTBUG-37990
                            photoPreview.source = "file://"+ camera.imageCapture.capturedImagePath
                        }
                    }
                } // camera
            
            NianoniaaN Offline
            NianoniaaN Offline
            Nianoniaa
            wrote on last edited by
            #4
            This post is deleted!
            1 Reply Last reply
            0

            • Login

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