IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

CameraCapture QML Type

An interface for capturing camera images.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

CameraCapture QML Type

  • Import Statement: import QtMultimedia 5.12

  • Group: CameraCapture is part of multimedia_qml, camera_qml

Detailed Description

This type allows you to capture still images and be notified when they are available or saved to disk. You can adjust the resolution of the captured image and where the saved image should go.

CameraCapture is a child of a Camera (as the imageCapture property) and cannot be created directly.

 
Sélectionnez
Item {
    width: 640
    height: 360

    Camera {
        id: camera

        imageCapture {
            onImageCaptured: {
                // Show the preview in an Image
                photoPreview.source = preview
            }
        }
    }

    VideoOutput {
        source: camera
        focus : visible // to receive focus and capture key events when visible
        anchors.fill: parent

        MouseArea {
            anchors.fill: parent;
            onClicked: camera.imageCapture.capture();
        }
    }

    Image {
        id: photoPreview
    }
}

Property Documentation

 

[read-only] capturedImagePath : string

This property holds the location of the last captured image.

[read-only] errorString : string

This property holds the error message related to the last capture.

[read-only] ready : bool

This property holds a bool value indicating whether the camera is ready to capture photos or not.

Calling capture() while ready is false is not permitted and results in an error.

resolution : size

This property holds the resolution/size of the image to be captured. If empty, the system chooses the appropriate resolution.

See Also

[read-only, since 5.9] supportedResolutions : list<size>

This property holds a list of resolutions which are supported for capturing. The information can be used to set a valid resolution. If the camera isn't loaded, the list will be empty.

This property was introduced in Qt 5.9.

See Also

See also resolution

Signal Documentation

 

captureFailed(requestId, message)

This signal is emitted when an error occurs during capture with requestId. A descriptive message is available in message.

The corresponding handler is onCaptureFailed.

The corresponding handler is onCaptureFailed.

imageCaptured(requestId, preview)

This signal is emitted when an image with requestId has been captured but not yet saved to the filesystem. The preview parameter can be used as the URL supplied to an Image.

The corresponding handler is onImageCaptured.

The corresponding handler is onImageCaptured.

See Also

See also imageSaved

imageMetadataAvailable(requestId, key, value)

This signal is emitted when the image with requestId has new metadata available with the key key and value value.

The corresponding handler is onImageMetadataAvailable.

The corresponding handler is onImageMetadataAvailable.

See Also

See also imageCaptured

imageSaved(requestId, path)

This signal is emitted after the image with requestId has been written to the filesystem. The path is a local file path, not a URL.

The corresponding handler is onImageSaved.

The corresponding handler is onImageSaved.

See Also

See also imageCaptured

Method Documentation

 

cancelCapture()

Cancel pending image capture requests.

capture()

Start image capture. The imageCaptured and imageSaved signals will be emitted when the capture is complete.

The image will be captured to the default system location, typically QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) for still imaged or QStandardPaths::writableLocation(QStandardPaths::MoviesLocation) for video.

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

See also ready

captureToLocation(location)

Start image capture to specified location. The imageCaptured and imageSaved signals will be emitted when the capture is complete.

CameraCapture::captureToLocation returns the capture requestId parameter, used with imageExposed(), imageCaptured(), imageMetadataAvailable() and imageSaved() signals.

If the application is unable to write to the location specified by location the CameraCapture will emit an error. The most likely reasons for the application to be unable to write to a location is that the path is wrong and the location does not exists, or the application does not have write permission for that location.

setMetadata(key, value)

Sets a particular metadata key to value for the subsequent image captures.

See Also

See also QMediaMetaData

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+