ImageCapture QML 類型

用於捕獲攝像頭圖像的接口。 更多...

import 語句: import QtMultimedia

特性

信號

方法

詳細描述

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
    }
}
					

特性文檔編製

error : enumeration [read-only]

This property holds the last error type that occurred. It can be one of the following.

常量 描述
ImageCapture.NoError No esrrors.
ImageCapture.NotReadyError The service is not ready for capture yet.
ImageCapture.ResourceError 設備未就緒 (或不可用)。
ImageCapture.OutOfSpaceError 設備沒有剩餘空間。
ImageCapture.NotSupportedFeatureError Device does not support stillimages capture.
ImageCapture.FormatError 不支持當前格式。

另請參閱 errorString .

errorString : string [read-only]

This property holds the last error message that occurred.

另請參閱 error .

fileFormat : enumeration

This property holds the file format for which the image will be written. It can be one of the following.

常量 描述
UnspecifiedFormat No format specified
JPEG .jpg or .jpeg format
PNG .png format
WebP .webp format
Tiff .tiff format

metaData : mediaMetaData

This property holds the metadata that wil be embedded into the image.

preview : string [read-only]

This property holds a url to the latest captured image. It can be connected to the source property of an 圖像 element to show the last captured image.

CaptureSession {
    camera: Camera {}
    imageCapture: ImageCapture {
        id: capture
    }
}
Image {
    source: capture.preview
}
					

另請參閱 saveToFile .

quality : enumeration

This property holds the quality hint when storing the captured image. It can be one of the following values.

常量 描述
VeryLowQuality Very low
LowQuality Low
NormalQuality Normal
HighQuality High
VeryHighQuality Very high

readyForCapture : bool [read-only]

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

調用 capture () 或 captureToFile () while ready is false is not permitted and results in an error.

信號文檔編製

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 .

注意: 相應處理程序是 onErrorOccurred .

另請參閱 error and errorString .

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.

注意: 相應處理程序是 onImageCaptured .

另請參閱 imageSaved and preview .

imageMetadataAvailable ( id , metaData )

This signal is emitted when the image with requested id has new metaData .

注意: 相應處理程序是 onImageMetadataAvailable .

另請參閱 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.

注意: 相應處理程序是 onImageSaved .

另請參閱 imageCaptured .

方法文檔編製

capture ()

開始圖像捕獲。 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 () 和 imageSaved () 信號。

另請參閱 readyForCapture and preview .

captureToFile ( location )

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

另請參閱 capture .

saveToFile ( location )

Saves the last captured image to location .

另請參閱 capture and preview .