QCamera 類提供係統攝像頭設備的接口。 更多...
| 頭: |
#include <QCamera>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
|
| qmake: |
QT += multimedia
|
| 在 QML: | Camera |
| 繼承: | QObject |
| enum | Error { NoError, CameraError } |
| enum | ExposureMode { ExposureAuto, ExposureManual, ExposurePortrait, ExposureNight, ExposureSports, …, ExposureBarcode } |
| 枚舉類 | Feature { ColorTemperature, ExposureCompensation, IsoSensitivity, ManualExposureTime, CustomFocusPoint, FocusDistance } |
| flags | Features |
| enum | FlashMode { FlashOff, FlashOn, FlashAuto } |
| enum | FocusMode { FocusModeAuto, FocusModeAutoNear, FocusModeAutoFar, FocusModeHyperfocal, FocusModeInfinity, FocusModeManual } |
| enum | TorchMode { TorchOff, TorchOn, TorchAuto } |
| enum | WhiteBalanceMode { WhiteBalanceAuto, WhiteBalanceManual, WhiteBalanceSunlight, WhiteBalanceCloudy, WhiteBalanceShade, …, WhiteBalanceSunset } |
|
|
| QCamera (QObject * parent = nullptr) | |
| QCamera (QCameraDevice::Position position , QObject * parent = nullptr) | |
| QCamera (const QCameraDevice & cameraDevice , QObject * parent = nullptr) | |
| virtual | ~QCamera () override |
| QCameraDevice | cameraDevice () const |
| QCameraFormat | cameraFormat () const |
| QMediaCaptureSession * | captureSession () const |
| int | colorTemperature () const |
| QPointF | customFocusPoint () const |
| QCamera::Error | error () const |
| QString | errorString () const |
| float | exposureCompensation () const |
| QCamera::ExposureMode | exposureMode () const |
| float | exposureTime () const |
| QCamera::FlashMode | flashMode () const |
| float | focusDistance () const |
| QCamera::FocusMode | focusMode () const |
| QPointF | focusPoint () const |
| bool | isActive () const |
| bool | isAvailable () const |
| bool | isExposureModeSupported (QCamera::ExposureMode mode ) const |
| bool | isFlashModeSupported (QCamera::FlashMode mode ) const |
| bool | isFlashReady () const |
| bool | isFocusModeSupported (QCamera::FocusMode mode ) const |
| bool | isTorchModeSupported (QCamera::TorchMode mode ) const |
| bool | isWhiteBalanceModeSupported (QCamera::WhiteBalanceMode mode ) const |
| int | isoSensitivity () const |
| float | manualExposureTime () const |
| int | manualIsoSensitivity () const |
| float | maximumExposureTime () const |
| int | maximumIsoSensitivity () const |
| float | maximumZoomFactor () const |
| float | minimumExposureTime () const |
| int | minimumIsoSensitivity () const |
| float | minimumZoomFactor () const |
| void | setCameraDevice (const QCameraDevice & cameraDevice ) |
| void | setCameraFormat (const QCameraFormat & format ) |
| void | setCustomFocusPoint (const QPointF & point ) |
| void | setFocusDistance (float d ) |
| void | setFocusMode (QCamera::FocusMode mode ) |
| void | setZoomFactor (float factor ) |
| QCamera::Features | supportedFeatures () const |
| QCamera::TorchMode | torchMode () const |
| QCamera::WhiteBalanceMode | whiteBalanceMode () const |
| float | zoomFactor () const |
| void | setActive (bool active ) |
| void | setAutoExposureTime () |
| void | setAutoIsoSensitivity () |
| void | setColorTemperature (int colorTemperature ) |
| void | setExposureCompensation (float ev ) |
| void | setExposureMode (QCamera::ExposureMode mode ) |
| void | setFlashMode (QCamera::FlashMode mode ) |
| void | setManualExposureTime (float seconds ) |
| void | setManualIsoSensitivity (int iso ) |
| void | setTorchMode (QCamera::TorchMode mode ) |
| void | setWhiteBalanceMode (QCamera::WhiteBalanceMode mode ) |
| void | start () |
| void | stop () |
| void | zoomTo (float factor , float rate ) |
| void | activeChanged (bool) |
| void | cameraDeviceChanged () |
| void | cameraFormatChanged () |
| void | colorTemperatureChanged () const |
| void | customFocusPointChanged () |
| void | errorChanged () |
| void | errorOccurred (QCamera::Error error , const QString & errorString ) |
| void | exposureCompensationChanged (float value ) |
| void | exposureModeChanged () |
| void | exposureTimeChanged (float speed ) |
| void | flashModeChanged () |
| void | flashReady (bool ready ) |
| void | focusDistanceChanged (float) |
| void | focusModeChanged () |
| void | focusPointChanged () |
| void | isoSensitivityChanged (int value ) |
| void | manualExposureTimeChanged (float speed ) |
| void | manualIsoSensitivityChanged (int) |
| void | maximumZoomFactorChanged (float) |
| void | minimumZoomFactorChanged (float) |
| void | supportedFeaturesChanged () |
| void | torchModeChanged () |
| void | whiteBalanceModeChanged () const |
| void | zoomFactorChanged (float) |
QCamera 可以用於 QMediaCaptureSession 為視頻錄製和圖像獲取。
可以使用 QCameraDevice 列錶可用攝像頭並選取要使用的攝像頭。
const QList<QCameraDevice> cameras = QMediaDevices::videoInputs(); for (const QCameraDevice &cameraDevice : cameras) { if (cameraDevice.description() == "mycamera") camera = new QCamera(cameraDevice); }
On hardware that supports it, QCamera lets you adjust the focus and zoom. The minimumZoomFactor and maximumZoomFactor properties provide the range of supported zoom factors. The zoomFactor property allows changing the zoom factor.
camera->setZoomFactor(3.0);
After capturing the raw data for a camera frame, the camera hardware and software performs various image processing tasks to produce the final image. This includes compensating for ambient light color, reducing noise, as well as making some other adjustments to the image.
You can control many of these processing steps through the Camera properties. For example, you can set the white balance (or color temperature) used for processing images:
camera->setWhiteBalanceMode(QCamera::WhiteBalanceFluorescent);
For more information on image processing of camera frames, see 攝像頭圖像處理 .
Most platforms require that the end-user grants permissions before a camera can be activated. It is therefore strongly recommended that application developers utilize the QCameraPermission class when working with cameras. The following is a short example that requests permissions from the end-user when the application starts, and then activates the camera if permissions are granted.
qApp->requestPermission( QCameraPermission{}, [](const QPermission &permission) { if (permission.status() == Qt::PermissionStatus::Granted) camera->setActive(true); });
見 攝像頭概述 瞭解更多信息。
注意: On WebAssembly platform, due to it's asynchronous nature, QMediaDevices::videoInputsChanged () signal is emitted when the list of video inputs is ready. User permissions are required. Works only on secure https contexts.
此枚舉保持最後錯誤代碼。
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::NoError
|
0
|
沒有齣現錯誤。 |
QCamera::CameraError
|
1
|
有齣現錯誤。 |
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::ExposureAuto
|
0
|
自動模式。 |
QCamera::ExposureManual
|
1
|
手動模式。 |
QCamera::ExposurePortrait
|
2
|
肖象曝光模式。 |
QCamera::ExposureNight
|
3
|
夜間模式。 |
QCamera::ExposureSports
|
4
|
亮點曝光模式。 |
QCamera::ExposureSnow
|
5
|
Snow exposure mode. |
QCamera::ExposureBeach
|
6
|
Beach exposure mode. |
QCamera::ExposureAction
|
7
|
Action mode. Since 5.5 |
QCamera::ExposureLandscape
|
8
|
Landscape mode. Since 5.5 |
QCamera::ExposureNightPortrait
|
9
|
Night portrait mode. Since 5.5 |
QCamera::ExposureTheatre
|
10
|
Theatre mode. Since 5.5 |
QCamera::ExposureSunset
|
11
|
Sunset mode. Since 5.5 |
QCamera::ExposureSteadyPhoto
|
12
|
Steady photo mode. Since 5.5 |
QCamera::ExposureFireworks
|
13
|
Fireworks mode. Since 5.5 |
QCamera::ExposureParty
|
14
|
Party mode. Since 5.5 |
QCamera::ExposureCandlelight
|
15
|
Candlelight mode. Since 5.5 |
QCamera::ExposureBarcode
|
16
|
Barcode mode. Since 5.5 |
Describes a set of features supported by the camera. The returned value can be a combination of:
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::Feature::ColorTemperature
|
0x1
|
The Camera supports setting a custom colorTemperature . |
QCamera::Feature::ExposureCompensation
|
0x2
|
The Camera supports setting a custom exposureCompensation . |
QCamera::Feature::IsoSensitivity
|
0x4
|
The Camera supports setting a custom isoSensitivity . |
QCamera::Feature::ManualExposureTime
|
0x8
|
The Camera supports setting a manual exposure Time . |
QCamera::Feature::CustomFocusPoint
|
0x10
|
The Camera supports setting a custom focus point . |
QCamera::Feature::FocusDistance
|
0x20
|
The Camera supports setting the focusDistance 特性。 |
Features 類型是 typedef 對於 QFlags <Feature>. It stores an OR combination of Feature values.
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::FlashOff
|
0
|
Flash is Off. |
QCamera::FlashOn
|
1
|
Flash is On. |
QCamera::FlashAuto
|
2
|
自動閃光。 |
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::FocusModeAuto
|
0
|
Continuous auto focus mode. |
QCamera::FocusModeAutoNear
|
1
|
Continuous auto focus mode on near objects. |
QCamera::FocusModeAutoFar
|
2
|
Continuous auto focus mode on objects far away. |
QCamera::FocusModeHyperfocal
|
3
|
Focus to hyperfocal distance, with the maximum depth of field achieved. All objects at distances from half of this distance out to infinity will be acceptably sharp. |
QCamera::FocusModeInfinity
|
4
|
Focus strictly to infinity. |
QCamera::FocusModeManual
|
5
|
Camera lens focus distance is locked according to focusDistance . |
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::TorchOff
|
0
|
Torch is Off. |
QCamera::TorchOn
|
1
|
Torch is On. |
QCamera::TorchAuto
|
2
|
Automatic torch. |
| 常量 | 值 | 描述 |
|---|---|---|
QCamera::WhiteBalanceAuto
|
0
|
Auto white balance mode. |
QCamera::WhiteBalanceManual
|
1
|
Manual white balance. In this mode the white balance should be set with setColorTemperature () |
QCamera::WhiteBalanceSunlight
|
2
|
Sunlight white balance mode. |
QCamera::WhiteBalanceCloudy
|
3
|
Cloudy white balance mode. |
QCamera::WhiteBalanceShade
|
4
|
Shade white balance mode. |
QCamera::WhiteBalanceTungsten
|
5
|
Tungsten (incandescent) white balance mode. |
QCamera::WhiteBalanceFluorescent
|
6
|
Fluorescent white balance mode. |
QCamera::WhiteBalanceFlash
|
7
|
Flash white balance mode. |
QCamera::WhiteBalanceSunset
|
8
|
Sunset white balance mode. |
Describes whether the camera is currently active.
訪問函數:
| bool | isActive () const |
| void | setActive (bool active ) |
通知程序信號:
| void | activeChanged (bool) |
返迴 QCameraDevice object associated with this camera.
When switching camera devices, the QCamera 's capabilities are updated. Additionally, the QCamera 's control properties (such as focusMode , flashMode , focusDistance , zoomFactor ) are updated as follows:
訪問函數:
| QCameraDevice | cameraDevice () const |
| void | setCameraDevice (const QCameraDevice & cameraDevice ) |
通知程序信號:
| void | cameraDeviceChanged () |
Returns the camera format currently used by the camera.
注意: When using the FFMPEG backend on an Android target device if you request YUV420P format, you will receive either a fully planar 4:2:0 YUV420P or a semi-planar NV12/NV21. This depends on the codec implemented by the device OEM.
注意: On macOS, camera-devices are shared across multiple applications on the operating system. This means that another application may override the format set by this property. Application developers should account for receiving video frames that have a different resolution, pixel format and framerate than what is described by this property. This property does not change when the device's format is modified by another application. The format described by this property can be re-applied to the device by re-activating the QCamera .
訪問函數:
| QCameraFormat | cameraFormat () const |
| void | setCameraFormat (const QCameraFormat & format ) |
通知程序信號:
| void | cameraFormatChanged () |
另請參閱 QCameraDevice::videoFormats .
Returns the current color temperature if the current white balance mode is
WhiteBalanceManual
. For other modes the return value is undefined.
訪問函數:
| int | colorTemperature () const |
| void | setColorTemperature (int colorTemperature ) |
通知程序信號:
| void | colorTemperatureChanged () const |
This property represents the position of the custom focus point, in relative frame coordinates: QPointF (0,0) points to the left top frame point, QPointF (0.5,0.5) points to the frame center.
You can check whether custom focus points are supported by querying supportedFeatures () with the Feature. CustomFocusPoint 標誌。
訪問函數:
| QPointF | customFocusPoint () const |
| void | setCustomFocusPoint (const QPointF & point ) |
通知程序信號:
| void | customFocusPointChanged () |
[read-only]
error
: const
Error
Returns the error state of the camera.
訪問函數:
| QCamera::Error | error () const |
通知程序信號:
| void | errorChanged () |
另請參閱 QCamera::Error .
[read-only]
errorString
: const
QString
Returns a human readable string describing a camera's error state.
訪問函數:
| QString | errorString () const |
通知程序信號:
| void | errorChanged () |
Exposure compensation in EV units.
Exposure compensation property allows to adjust the automatically calculated exposure.
訪問函數:
| float | exposureCompensation () const |
| void | setExposureCompensation (float ev ) |
通知程序信號:
| void | exposureCompensationChanged (float value ) |
This property holds the exposure mode being used.
訪問函數:
| QCamera::ExposureMode | exposureMode () const |
| void | setExposureMode (QCamera::ExposureMode mode ) |
通知程序信號:
| void | exposureModeChanged () |
另請參閱 QCamera::isExposureModeSupported .
[read-only]
exposureTime
: const
float
Camera's exposure time in seconds.
訪問函數:
| float | exposureTime () const |
通知程序信號:
| void | exposureTimeChanged (float speed ) |
另請參閱 minimumExposureTime (), maximumExposureTime (),和 setManualExposureTime ().
This property holds the flash mode being used.
Enables a certain flash mode if the camera has a flash.
Assigning an unsupported mode to this property has no effect.
This property only has an effect when capturing images using QImageCapture
訪問函數:
| QCamera::FlashMode | flashMode () const |
| void | setFlashMode (QCamera::FlashMode mode ) |
通知程序信號:
| void | flashModeChanged () |
另請參閱 QCamera::FlashMode , QCamera::isFlashModeSupported ,和 QCamera::isFlashReady .
[read-only]
flashReady
: const
bool
Indicates if the flash is charged and ready to use.
訪問函數:
| bool | isFlashReady () const | [見下文注意事項] |
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
通知程序信號:
| void | flashReady (bool ready ) |
This property defines the lens focus distance when the camera device works in manual focus mode. Valid values range from 0 to 1, where 0 is the closest possible focus distance, and 1 is the farthest. The farthest point is typically at infinity, but this may not be the case for all devices.
This property is applied to the device only when focusMode 被設為 FocusModeManual ,和 supportedFeatures includes the Feature::FocusDistance 標誌。
If you assign a value to this property while
focusMode
is not set to
QCamera::FocusModeManual
, the property stores the value but does not affect the device until
QCamera::FocusModeManual
is active.
Assigning a value outside the valid range [0, 1] has no effect on this property.
若 supportedFeatures does not include the FocusDistance flag, any attempt to set this property is ignored.
This property will not be updated by the camera when it is in an automatic focus mode.
默認值為 1。
訪問函數:
| float | focusDistance () const |
| void | setFocusDistance (float d ) |
通知程序信號:
| void | focusDistanceChanged (float) |
This property holds the current camera focus mode.
This property holds the value that controls focus mode for the camera device. In all autofocus modes, the camera device keeps focusing continuously.
To check whether the camera device supports a particular focus mode, pass the corresponding FocusMode value to the isFocusModeSupported function as a parameter. The function returns false if the focus mode value is not supported. Assigning an unsupported mode to this property has no effect.
If you set the focusMode property to QCamera::FocusModeManual , the lens locks to the focus according to focusDistance .
訪問函數:
| QCamera::FocusMode | focusMode () const |
| void | setFocusMode (QCamera::FocusMode mode ) |
通知程序信號:
| void | focusModeChanged () |
另請參閱 isFocusModeSupported ().
[read-only]
focusPoint
: const
QPointF
Returns the point currently used by the auto focus system to focus onto.
訪問函數:
| QPointF | focusPoint () const |
通知程序信號:
| void | focusPointChanged () |
[read-only]
isoSensitivity
: const
int
This property holds the sensor ISO sensitivity.
Describes the ISO sensitivity currently used by the camera.
訪問函數:
| int | isoSensitivity () const |
通知程序信號:
| void | isoSensitivityChanged (int value ) |
另請參閱 setAutoIsoSensitivity () 和 setManualIsoSensitivity ().
Set the manual exposure time to seconds
訪問函數:
| float | manualExposureTime () const |
| void | setManualExposureTime (float seconds ) |
通知程序信號:
| void | manualExposureTimeChanged (float speed ) |
Describes a manually set ISO sensitivity
Setting this property to -1 (the default), implies that the camera automatically adjusts the ISO sensitivity.
訪問函數:
| int | manualIsoSensitivity () const |
| void | setManualIsoSensitivity (int iso ) |
通知程序信號:
| void | manualIsoSensitivityChanged (int) |
[read-only]
maximumZoomFactor
: const
float
Returns the maximum zoom factor.
This will be
1.0
on cameras that do not support zooming.
訪問函數:
| float | maximumZoomFactor () const |
通知程序信號:
| void | maximumZoomFactorChanged (float) |
[read-only]
minimumZoomFactor
: const
float
Returns the minimum zoom factor.
This will be
1.0
on cameras that do not support zooming.
訪問函數:
| float | minimumZoomFactor () const |
通知程序信號:
| void | minimumZoomFactorChanged (float) |
[read-only]
supportedFeatures
: const
Features
Returns the features supported by this camera.
訪問函數:
| QCamera::Features | supportedFeatures () const |
通知程序信號:
| void | supportedFeaturesChanged () |
另請參閱 QCamera::Feature .
This property holds the torch mode being used.
A torch is a continuous source of light. It can be used during video recording in low light conditions. Enabling torch mode will usually override any currently set flash mode.
訪問函數:
| QCamera::TorchMode | torchMode () const |
| void | setTorchMode (QCamera::TorchMode mode ) |
通知程序信號:
| void | torchModeChanged () |
另請參閱 QCamera::TorchMode , QCamera::isTorchModeSupported ,和 QCamera::flashMode .
Returns the white balance mode being used.
訪問函數:
| QCamera::WhiteBalanceMode | whiteBalanceMode () const |
| void | setWhiteBalanceMode (QCamera::WhiteBalanceMode mode ) |
通知程序信號:
| void | whiteBalanceModeChanged () const |
This property holds the current zoom factor.
Gets or sets the current zoom factor. Values will be clamped between minimumZoomFactor and maximumZoomFactor .
訪問函數:
| float | zoomFactor () const |
| void | setZoomFactor (float factor ) |
通知程序信號:
| void | zoomFactorChanged (float) |
[explicit]
QCamera::
QCamera
(
QObject
*
parent
= nullptr)
Construct a QCamera with a parent .
Selects the default camera on the system if more than one camera is available.
[explicit]
QCamera::
QCamera
(
QCameraDevice::Position
position
,
QObject
*
parent
= nullptr)
Construct a QCamera which uses a hardware camera located a the specified position .
For example on a mobile phone it can be used to easily choose between front-facing and back-facing cameras.
If no camera is available at the specified position or if position is QCameraDevice::UnspecifiedPosition , the default camera is used.
[explicit]
QCamera::
QCamera
(const
QCameraDevice
&
cameraDevice
,
QObject
*
parent
= nullptr)
Construct a QCamera from a camera description cameraDevice and parent .
[override virtual noexcept]
QCamera::
~QCamera
()
銷毀攝像頭對象。
Returns the capture session this camera is connected to, or a nullptr if the camera is not connected to a capture session.
使用 QMediaCaptureSession::setCamera () to connect the camera to a session.
[signal]
void
QCamera::
errorOccurred
(
QCamera::Error
error
, const
QString
&
errorString
)
This signal is emitted when error state changes to error . A description of the error is provided as errorString .
[signal]
void
QCamera::
exposureCompensationChanged
(
float
value
)
Signal emitted when the exposure compensation changes to value .
注意: 通知程序信號對於特性 exposureCompensation .
Returns the current exposure time in seconds.
注意: Getter function for property exposureTime.
[signal]
void
QCamera::
exposureTimeChanged
(
float
speed
)
Signals that a camera's exposure speed 已改變。
注意: 通知程序信號對於特性 exposureTime .
[signal]
void
QCamera::
flashReady
(
bool
ready
)
Signal the flash ready status has changed.
注意: Notifier signal for property flashReady.
[signal]
void
QCamera::
focusModeChanged
()
Signals when the focusMode 改變。
注意: 通知程序信號對於特性 focusMode .
Returns true if the camera is currently active.
注意: getter 函數對於特性 active .
Returns true if the camera can be used.
[invokable]
bool
QCamera::
isExposureModeSupported
(
QCamera::ExposureMode
mode
) const
Returns true if the exposure mode is supported.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
[invokable]
bool
QCamera::
isFlashModeSupported
(
QCamera::FlashMode
mode
) const
Returns true if the flash mode is supported.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
[invokable]
bool
QCamera::
isFlashReady
() const
Returns true if flash is charged.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
注意: getter 函數對於特性 flashReady .
[invokable]
bool
QCamera::
isFocusModeSupported
(
QCamera::FocusMode
mode
) const
返迴
true
if the focus
mode
is supported by the camera.
若 FocusModeManual is reported as supported, the feature Feature::FocusDistance is implied to be supported as well.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
[invokable]
bool
QCamera::
isTorchModeSupported
(
QCamera::TorchMode
mode
) const
Returns true if the torch mode is supported.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
[invokable]
bool
QCamera::
isWhiteBalanceModeSupported
(
QCamera::WhiteBalanceMode
mode
) const
Returns true if the white balance mode is supported.
注意: 此函數可以被援引,通過元對象係統和從 QML。見 Q_INVOKABLE .
[signal]
void
QCamera::
isoSensitivityChanged
(
int
value
)
Signal emitted when sensitivity changes to value .
注意: 通知程序信號對於特性 isoSensitivity .
Returns the manual exposure time in seconds, or -1 if the camera is using automatic exposure times.
注意: Getter function for property manualExposureTime.
另請參閱 setManualExposureTime ().
The maximal exposure time in seconds.
Returns the maximum ISO sensitivity supported by the camera.
The minimal exposure time in seconds.
Returns the minimum ISO sensitivity supported by the camera.
[slot]
void
QCamera::
setActive
(
bool
active
)
Turns the camera on if
active
is
true
, or off if it's
false
.
注意: setter 函數對於特性 active .
另請參閱 isActive ().
[slot]
void
QCamera::
setAutoExposureTime
()
Use automatically calculated exposure time
[slot]
void
QCamera::
setAutoIsoSensitivity
()
Turn on auto sensitivity
Connects the camera object to the physical camera device described by cameraDevice . Using a default constructed QCameraDevice object as cameraDevice will connect the camera to the system default camera device.
When switching camera devices, the QCamera 's capabilities are updated. Additionally, the QCamera 's control properties (such as focusMode , flashMode , focusDistance , zoomFactor ) are updated as follows:
注意: setter 函數對於特性 cameraDevice .
另請參閱 cameraDevice ().
Tells the camera to use the format described by format . This can be used to define a specific resolution and frame rate to be used for recording and image capture.
注意: When using the FFMPEG backend on an Android target device if you request YUV420P format, you will receive either a fully planar 4:2:0 YUV420P or a semi-planar NV12/NV21. This depends on the codec implemented by the device OEM.
注意: setter 函數對於特性 cameraFormat .
另請參閱 cameraFormat ().
[slot]
void
QCamera::
setColorTemperature
(
int
colorTemperature
)
Sets manual white balance to
colorTemperature
. This is used when
whiteBalanceMode
() 被設為
WhiteBalanceManual
. The units are Kelvin.
Setting a color temperature will only have an effect if WhiteBalanceManual is supported. In this case, setting a temperature greater 0 will automatically set the white balance mode to WhiteBalanceManual . Setting the temperature to 0 will reset the white balance mode to WhiteBalanceAuto .
注意: setter 函數對於特性 colorTemperature .
另請參閱 colorTemperature ().
[slot]
void
QCamera::
setWhiteBalanceMode
(
QCamera::WhiteBalanceMode
mode
)
Sets the white balance to mode .
注意: setter 函數對於特性 whiteBalanceMode .
另請參閱 whiteBalanceMode ().
Zooms to a zoom factor factor at a rate of 1 factor per second.
注意: setter 函數對於特性 zoomFactor .
另請參閱 zoomFactor ().
[slot]
void
QCamera::
start
()
Starts the camera.
如同 setActive (true)。
If the camera can't be started for some reason, the errorOccurred () 信號發射。
[slot]
void
QCamera::
stop
()
Stops the camera. Same as setActive (false).
[slot]
void
QCamera::
zoomTo
(
float
factor
,
float
rate
)
Zooms to a zoom factor factor 使用 rate .
The rate is specified in powers of two per second. At a rate of 1 it would take 2 seconds to go from a zoom factor of 1 to 4.
注意: Using a specific rate is not supported on all cameras. If not supported, zooming will happen as fast as possible.