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

CameraFocus QML Type

An interface for focus related camera settings.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

CameraFocus QML Type

  • Import Statement: import QtMultimedia 5.12

  • Group: CameraFocus is part of multimedia_qml, camera_qml

Detailed Description

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.

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

Property Documentation

 

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:

Value

Description

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

The property can take one of the following values:

Value

Description

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 property.

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

Value

Description

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.

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

[read-only, since 5.11] supportedFocusModes : list<FocusMode>

This property holds the supported focus modes of the camera.

This property was introduced in Qt 5.11.

See Also

See also focusMode

[read-only, since 5.10] supportedFocusPointModes : list<enumeration>

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

This property was introduced in Qt 5.10.

See Also

See also focusPointMode

Obsolete Members for CameraFocus

The following members of QML type CameraFocus are deprecated. We strongly advise against using them in new code.

Obsolete Method Documentation

 
bool isFocusModeSupported(mode)

This method is deprecated. We strongly advise against using it in new code.

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

bool isFocusPointModeSupported(mode)

This method is deprecated. We strongly advise against using it in new code.

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

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