Unsolved Capture image without saving
-
how capture and preview image without saving QML camera? is it posible?
-
Hi,
You have an example of that in the detailed description of the Camera type.
-
@SGaist
Hi.
i have already seen this post. Can you give me some code please :)
i know how to capture image, but it saves automaticaly but i dont want save image -
There is an example application "QML Camera Example" that has code. Works with my webcam on win10, qt5.8
-
@6thC
listen bro, i think that you dont realize what i want... when i write code like this ==> camera.imagecapture.captured(), it saves capture and i dont want save. do you understand? -
From a quick look at the Camera element and related sources, it seems that it's currently not possible.
As a work around, you could set the location to a temporary place that you'll nuke whenever you want/need to.
-
@Taz742 Jep, @SGaist suggested solutions seems to be the only one that's possible at the moment. I did basically the same in my application. After the image is written to disk, I am deleting the image again. If you are not using the Camera very heavily this approach should be fine. If however you are constantly taking a picture, this approach can really stress out your data storage (flash, sd card). During my research of the problem, I also found another approach that's based on
QVideoProbe
, but unfortunately this doesn't work on all platforms. See: http://lists.qt-project.org/pipermail/interest/2014-February/011125.html -
Any reason you don't fall back on the c++ version of QCamera?
Previously the c++ version did only run on Win without problems. But I was pleasant surpriesed, when I tested the Camera-example with QT5.8 on IOS and everything worked without problem.
-
@Schluchti It's possible to use QAbstractVideoFilter, more info here : http://blog.qt.io/blog/2015/03/20/introducing-video-filters-in-qt-multimedia/
@Taz742 What platform do you target ?
AFAIK it's possible to implement a QCameraImageCapture with setCaptureDestination(CaptureToBuffer) and replace the default one from Camera, but CaptureToBuffer is not supported on iOS : https://bugreports.qt.io/browse/QTBUG-46280?filter=14826 -
You could also have a look at the NativeUtils Camera Picker that comes with V-Play. It allows you to take a picture from QML with just a few lines of QML code. The picture is not saved by default, it's just a temporary file which is deleted automatically when the app is closed.
This works an Android and iOS.
Have a look at this code sample:
AppButton { text: "Take Picture!" onClicked: nativeUtils.displayCameraPicker() } Connections { target: nativeUtils onCameraPickerFinished: { testImage.source = path } } Image { id: testImage // we will display the image here }