CameraFocus QML Type

An interface for focus related camera settings. 更多...

import 语句: import QtMultimedia 5.15

特性

详细描述

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.

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.

focusMode : enumeration

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

描述
FocusManual Manual or fixed focus mode.
FocusHyperfocal 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.
FocusInfinity Focus strictly to infinity.
FocusAuto One-shot auto focus mode.
FocusContinuous Continuous auto focus mode.
FocusMacro One shot auto focus to objects close to camera.

It's possible to combine multiple Camera::FocusMode values, for example Camera.FocusMacro + Camera.FocusContinuous.

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

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 customFocusPoint property allows you to specify which part of the frame to focus on.

The property can take one of the following values:

描述
FocusPointAuto Automatically select one or multiple focus points.
FocusPointCenter Focus to the frame center.
FocusPointFaceDetection Focus on faces in the frame.
FocusPointCustom Focus to the custom point, defined by the customFocusPoint 特性。

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:

描述
Camera.FocusAreaUnused This focus point area is currently unused in autofocusing.
Camera.FocusAreaSelected This focus point area is used in autofocusing, but is not in focus.
Camera.FocusAreaFocused This focus point is used in autofocusing, and is in focus.
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
          }
    }
}
					

supportedFocusModes : list < FocusMode >

This property holds the supported focus modes of the camera.

该特性在 Qt 5.11 引入。

另请参阅 focusMode .

supportedFocusPointModes : list < enumeration >

This property holds the supported focus point modes of the camera.

该特性在 Qt 5.10 引入。

另请参阅 focusPointMode .