ImageCapture QML Type
An interface for capturing camera images. More...
Import Statement: | import QtMultimedia |
Properties
- preview : string
- readyForCapture : bool
Signals
- errorOccurred(id, error, errorString)
- imageCaptured(requestId, preview)
- imageMetadataAvailable(id, metaData)
- imageSaved(id, fileName)
Methods
- capture()
- captureToFile(location)
- saveToFile(location)
Detailed Description
This type allows you to capture still images and be notified when they are available or saved to disk.
Item { width: 640 height: 360 CaptureSession { imageCapture : ImageCapture { id: imageCapture } camera: Camera { id: camera } videoOutput: videoOutput } VideoOutput { id: videoOutput anchors.fill: parent MouseArea { anchors.fill: parent; onClicked: imageCapture.capture(); } } Image { id: photoPreview source: imageCapture.preview // always shows the last captured image } }
Property Documentation
preview : string |
This property holds a url to the latest captured image. It can be connected to the source property of an Image element to show the last captured image.
CaptureSession { camera: Camera {} imageCapture: ImageCapture { id: capture } } Image { source: capture.preview }
See also saveToFile.
readyForCapture : bool |
This property holds a bool value indicating whether the camera is ready to capture photos or not.
Calling capture() or captureToFile() while ready is false
is not permitted and results in an error.
Signal Documentation
errorOccurred(id, error, errorString) |
This signal is emitted when an error occurs during capture with requested id. error is an enumeration of type ImageCapture::Error. A descriptive message is available in errorString.
Note: The corresponding handler is onErrorOccurred
.
imageCaptured(requestId, preview) |
This signal is emitted when an image with requested id requestId has been captured but not yet saved to the filesystem. The preview parameter is the captured image.
Note: The corresponding handler is onImageCaptured
.
See also imageSaved and preview.
imageMetadataAvailable(id, metaData) |
This signal is emitted when the image with requested id has new metaData.
Note: The corresponding handler is onImageMetadataAvailable
.
See also imageCaptured.
imageSaved(id, fileName) |
This signal is emitted after the image with requested id has been written to the filesystem. The fileName is a local file path, not a URL.
Note: The corresponding handler is onImageSaved
.
See also imageCaptured.
Method Documentation
capture() |
Start image capture. The imageCaptured and imageSaved signals will be emitted when the capture is complete.
The captured image will be available through the preview property that can be used as the source for a QML Image item. The saveToFile() method can then be used save the image.
Camera saves all the capture parameters like exposure settings or image processing parameters, so changes to camera parameters after capture() is called do not affect previous capture requests.
capture() returns the capture requestId parameter, used with imageExposed(), imageCaptured(), imageMetadataAvailable() and imageSaved() signals.
See also readyForCapture and preview.
captureToFile(location) |
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.