问题
I Use Qt 5.12.5 and I have qt quick controls 2 project that I run it on my Android Device.
Now I have a problem,the signal imageSaved
of Camera
Not trigger?
In below when I click button Camera should capture
Button{
onClicked: {
camera.imageCapture.capture();
}
}
After Clicking the Button imageCaptured
signal runs, the photoPrevew
shows the captured image ,But onImageSaved
Not running and I don't see any captured image in my Gallery!
Camera {
id: camera
position: Camera.BackFace
imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
flash.mode: Camera.FlashRedEyeReduction
imageCapture {
onImageCaptured: { ///this runs after capturing
camera.stop();
console.log("preview="+preview); /// preview=image://camera/preview_1
photoPreview.source = preview ///photoPreview shows the capthed Image
var imgPath = camera.imageCapture.capturedImagePath
console.log("image Path=>"+imgPath); /// path is null
}
onCaptureFailed: {
console.log("onCaptureFailed");
console.log(message);
}
onImageSaved: { ///This not running
console.log("*** onImageSaved ***");
console.log("path=> "+path);
up.loadImageFromFile("file://"+ path,imageOrientation);//this class upload Image to server
}
}
focus {
focusMode: Camera.FocusContinuous
focusPointMode: Camera.FocusPointCenter
}
}
Application Output
D ViewRootImpl: ViewPostImeInputStage processPointer 0
D ViewRootImpl: ViewPostImeInputStage processPointer 1
D SensorManager: registerListener :: 0, BMC150 Acceleration Sensor, 200000, 0,
E libGLESv1: HWUI Protection: wrong call from hwui context F:ES1-glDeleteTexturesSEC
D libEGL : eglInitialize EGLDisplay = 0x9a3ff074
D libEGL : eglInitialize EGLDisplay = 0x9a3ff074
D libEGL : eglInitialize EGLDisplay = 0x9a3ff074
D ViewRootImpl: ViewPostImeInputStage processPointer 0
D ViewRootImpl: ViewPostImeInputStage processPointer 1
D SensorManager: unregisterListener ::
D Camera : app passed NULL surface
D libEGL : eglTerminate EGLDisplay = 0x9727ee84
D libEGL : eglTerminate EGLDisplay = 0x9727ee84
D Camera : app passed NULL surface
D libEGL : eglTerminate EGLDisplay = 0xaea744cc
D libEGL : eglTerminate EGLDisplay = 0xaea744b4
D MYAPP: qml: preview=image://camera/preview_1
D MYAPP: qml: image Path=>
来源:https://stackoverflow.com/questions/59117481/camera-not-saving-the-captured-image