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

ImageCapture QML Type

An interface for capturing camera images.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

ImageCapture QML Type

  • Import Statement: import QtMultimedia

  • Group: ImageCapture 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.

 
Sélectionnez
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

 

[read-only] 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.

 
Sélectionnez
CaptureSession {
    camera: Camera {}
    imageCapture: ImageCapture {
        id: capture
    }
}
Image {
    source: capture.preview
}
See Also

See also saveToFile

[read-only] 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(requestId, error, message)

This signal is emitted when an error occurs during capture with requestId. error is an enumeration of type ImageCapture::Error. A descriptive message is available in message.

The corresponding handler is onErrorOccurred.

imageCaptured(requestId, previewImage)

This signal is emitted when an image with requestId has been captured but not yet saved to the filesystem. The previewImage parameter is the captured image.

The corresponding handler is onImageCaptured.

See Also

See also imageSaved, preview

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.

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.

See Also

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

captureToFile(location)

Does the same as capture() but additionally automatically saves the captured image to the specified location.

See Also

See also capture

saveToFile(location)

Saves the last captured image to location.

See Also

See also capture, preview

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