您的位置:首页 > 编程语言 > Qt开发

QtMultiMedia 之 CameraFocus

2016-02-27 11:39 645 查看

QtMultiMedia 之 CameraFocus

翻译:qyvlik


5.5.1

用来控制相机焦点的接口

属性

customFocusPoint
:
point


focusMode
:
enumeration


focusPointMode
:
enumeration


focusZones
:
list<focusZone>


方法

bool isFocusModeSupported(mode)


bool isFocusPointModeSupported(mode)


详细描述

This type allows control over manual and automatic focus settings, including information about any parts of the camera frame that are selected for autofocusing.

此类可以设置手动调焦或者自动聚焦。

It should not be constructed separately, instead the focus property of a Camera should be used.

不可直接创建,只能通过
Camera::focus
对象访问。

[code]Item {
    width: 640
    height: 360

    Camera {
        id: camera

        focus {
            focusMode: Camera.FocusMacro
            focusPointMode: Camera.FocusPointCustom
            customFocusPoint: Qt.point(0.2, 0.2) // Focus relative to top-left corner
        }
    }

    VideoOutput {
        source: camera
        anchors.fill: parent
    }
}


属性文档

customFocusPoint
:
point


This property holds the position of 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.

Custom focus point is used only in FocusPointCustom focus mode.

自定义焦点位置,与帧的坐标相关,
QPointF(0, 0)
表示帧的左上角,
QPointF(0.5, 0.5)
表示帧的中点。

自定义焦点只能在
FocusPointCustom
模式下起作用。

focusMode
:
enumeration


This property holds the current camera focus mode, which can be one of the following values:

ValueDescription
FocusManualManual or fixed focus mode.
FocusHyperfocalFocus 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.
FocusInfinityFocus strictly to infinity.
FocusAutoOne-shot auto focus mode.
FocusContinuousContinuous auto focus mode.
FocusMacroOne shot auto focus to objects close to camera.
该属性保存了相机的对焦模式,有如下值:

描述
FocusManual手动模式
FocusHyperfocalFocus 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.
FocusInfinityFocus strictly to infinity.
FocusAutoOne-shot auto focus mode.
FocusContinuousContinuous auto focus mode.
FocusMacroOne shot auto focus to objects close to camera.
It’s possible to combine multiple
Camera::FocusMode
values, for example
Camera.FocusMacro
+
Camera.FocusContinuous
.

可以将多个
Camera::FocusMode
联合起来,例如
Camera.FocusMacro
+
Camera.FocusContinuous
。(话说不是使用
|
?)

In automatic focusing modes, the focusPointMode property and focusZones property provide information and control over how automatic focusing is performed.

在自动聚焦模式下,
focusPointMode
focusZones
为更好地聚焦提供了必要的信息。

focusPointMode
:
enumeration


This property holds the current camera focus point mode. It is used in automatic focusing modes to determine what to focus on. If the current focus point mode is
Camera.FocusPointCustom
, the
customFocusPoint
property allows you to specify which part of the frame to focus on.

点聚焦模式,默认使用自动聚焦模式来自行决定使用何种点聚焦模式。如果使用处于自定义点聚焦模式,
customFocusPoint
属性允许为每一帧图像执行特定的聚焦点。

The property can take one of the following values:

ValueDescription
FocusPointAutoAutomatically select one or multiple focus points.
FocusPointCenterFocus to the frame center.
FocusPointFaceDetectionFocus on faces in the frame.
FocusPointCustomFocus to the custom point, defined by the customFocusPoint property.
可能的值如下:

描述
FocusPointAuto自动点聚焦模式
FocusPointCenter中点聚焦模式
FocusPointFaceDetection人脸识别点聚焦模式
FocusPointCustom自定义点聚焦模式
focusZones
:
list<focusZone>


This property holds the list of current camera focus zones, each including area specified in the same coordinates as customFocusPoint, and zone status as one of the following values:

聚焦区域,每一个包含
customFocusPoint
的区域,可能的值如下:

ValueDescription
Camera.FocusAreaUnusedThis focus point area is currently unused in autofocusing.
Camera.FocusAreaSelectedThis focus point area is used in autofocusing, but is not in focus.
Camera.FocusAreaFocusedThis focus point is used in autofocusing, and is in focus.
描述
Camera.FocusAreaUnused自动聚焦时未使用到此区域。
Camera.FocusAreaSelected自动聚焦时使用到此区域,但是还未对区域聚焦。
Camera.FocusAreaFocused自动聚焦时使用到此区域,且进行了聚焦。
[code]VideoOutput {
    id: viewfinder
    source: camera

    //display focus areas on camera viewfinder:
    Repeater {
          model: camera.focus.focusZones

          Rectangle {
              border {
                  width: 2
                  color: status == Camera.FocusAreaFocused ? "green" : "white"
              }
              color: "transparent"

              // Map from the relative, normalized frame coordinates
              property variant mappedRect: viewfinder.mapNormalizedRectToItem(area);

              x: mappedRect.x
              y: mappedRect.y
              width: mappedRect.width
              height: mappedRect.height
          }
    }
}


方法文档

bool isFocusModeSupported(mode) const


Returns true if the supplied mode is a supported focus mode, and false otherwise.

检查某对焦模式是否可以使用。

bool isFocusPointModeSupported(mode) const


Returns true if the supplied mode is a supported focus point mode, and false otherwise.

检查某聚焦点模式是否可以使用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: