Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QCameraFocus Class

The QCameraFocus class provides an interface for focus and zoom related camera settings. More...

 #include <QCameraFocus>

Inherits: QObject.

Public Types

enum FocusMode { ManualFocus, HyperfocalFocus, InfinityFocus, AutoFocus, ContinuousFocus, MacroFocus }
flags FocusModes
enum FocusPointMode { FocusPointAuto, FocusPointCenter, FocusPointFaceDetection, FocusPointCustom }

Properties

  • 1 property inherited from QObject

Public Functions

QPointF customFocusPoint() const
qreal digitalZoom() const
FocusModes focusMode() const
FocusPointMode focusPointMode() const
QCameraFocusZoneList focusZones() const
bool isAvailable() const
bool isFocusModeSupported(FocusModes mode) const
bool isFocusPointModeSupported(FocusPointMode mode) const
qreal maximumDigitalZoom() const
qreal maximumOpticalZoom() const
qreal opticalZoom() const
void setCustomFocusPoint(const QPointF & point)
void setFocusMode(FocusModes mode)
void setFocusPointMode(FocusPointMode mode)
void zoomTo(qreal optical, qreal digital)
  • 31 public functions inherited from QObject

Signals

void digitalZoomChanged(qreal value)
void focusZonesChanged()
void maximumDigitalZoomChanged(qreal zoom)
void maximumOpticalZoomChanged(qreal zoom)
void opticalZoomChanged(qreal value)

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QCameraFocus class provides an interface for focus and zoom related camera settings.

On hardware that supports it, this class lets you adjust the focus or zoom (both optical and digital). This also includes things like "Macro" mode for close up work (e.g. reading barcodes, or recognising letters), or "touch to focus" - indicating an interesting area of the viewfinder for the hardware to attempt to focus on.

 QCameraFocus *focus = camera->focus();
 focus->setFocusPointMode(QCameraFocus::FocusPointCustom);
 focus->setCustomFocusPoint(QPointF(0.25f, 0.75f)); // A point near the bottom left, 25% away from the corner, near that shiny vase

Zooming can be accomplished in a number of ways - usually the more expensive but higher quality approach is an optical zoom, which allows using the full extent of the camera sensor to gather image pixels. In addition it is possible to digitally zoom, which will generally just enlarge part of the sensor frame and throw away other parts. If the camera hardware supports optical zoom this should generally always be used first. The maximumOpticalZoom() method allows this to be checked. The zoomTo() method allows changing both optical and digital zoom at once.

 focus->zoomTo(3.0, 4.0); // Super zoom!

Some notes on autofocus

Some hardware supports a movable focus lens assembly, and typically this hardware also supports automatically focusing via some heuristic. You can influence this via the FocusPointMode setting - typically the center of the frame is brought into focus, but some hardware also supports focusing on any faces detected in the frame, or on a specific point (usually provided by a user in a "touch to focus" scenario).

This class (in combination with QCameraFocusZone) can expose information on what parts of the camera sensor image are in focus or are being used for autofocusing via the focusZones() property:

 focus->setFocusPointMode(QCameraFocus::FocusPointAuto);
 QList<QCameraFocusZone> zones = focus->focusZones();
 foreach (QCameraFocusZone zone, zones) {
     if (zone.status() == QCameraFocusZone::Focused) {
         // Draw a green box at zone.area()
     } else if (zone.status() == QCameraFocusZone::Selected) {
         // This area is selected for autofocusing, but is not in focus
         // Draw a yellow box at zone.area()
     }
 }

See also QCameraFocusZone.

Member Type Documentation

enum QCameraFocus::FocusMode
flags QCameraFocus::FocusModes

ConstantValueDescription
QCameraFocus::ManualFocus0x1Manual or fixed focus mode.
QCameraFocus::HyperfocalFocus0x02Focus 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.
QCameraFocus::InfinityFocus0x04Focus strictly to infinity.
QCameraFocus::AutoFocus0x8One-shot auto focus mode.
QCameraFocus::ContinuousFocus0x10Continuous auto focus mode.
QCameraFocus::MacroFocus0x20One shot auto focus to objects close to camera.

The FocusModes type is a typedef for QFlags<FocusMode>. It stores an OR combination of FocusMode values.

enum QCameraFocus::FocusPointMode

ConstantValueDescription
QCameraFocus::FocusPointAuto0Automatically select one or multiple focus points.
QCameraFocus::FocusPointCenter1Focus to the frame center.
QCameraFocus::FocusPointFaceDetection2Focus on faces in the frame.
QCameraFocus::FocusPointCustom3Focus to the custom point, defined by QCameraFocus::customFocusPoint property.

Property Documentation

customFocusPoint : QPointF

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.

The custom focus point property is used only in FocusPointCustom focus mode.

Access functions:

QPointF customFocusPoint() const
void setCustomFocusPoint(const QPointF & point)

digitalZoom : const qreal

This property holds the current digital zoom value.

Access functions:

qreal digitalZoom() const

Notifier signal:

void digitalZoomChanged(qreal value)

See also QCameraFocus::opticalZoom.

focusMode : FocusModes

This property holds the current camera focus mode.

This controls the way the camera lens assembly is configured.

Access functions:

FocusModes focusMode() const
void setFocusMode(FocusModes mode)

See also QCameraFocus::isFocusModeSupported().

focusPointMode : FocusPointMode

This property holds the current camera focus point selection mode.

If the camera focus mode is set to use an autofocusing mode, this property controls the way the camera will select areas of the frame to use for autofocusing.

Access functions:

FocusPointMode focusPointMode() const
void setFocusPointMode(FocusPointMode mode)

See also QCameraFocus::isFocusPointModeSupported().

focusZones : const QCameraFocusZoneList

Returns the list of active focus zones.

If QCamera::FocusPointAuto or QCamera::FocusPointFaceDetection focus mode is selected this method returns the list of zones the camera is actually focused on.

The coordinates system is the same as for custom focus points: QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center.

Access functions:

QCameraFocusZoneList focusZones() const

Notifier signal:

void focusZonesChanged()

opticalZoom : const qreal

This property holds the current optical zoom value.

Access functions:

qreal opticalZoom() const

Notifier signal:

void opticalZoomChanged(qreal value)

See also QCameraFocus::digitalZoom.

Member Function Documentation

bool QCameraFocus::isAvailable() const

Returns true if focus related settings are supported by this camera.

You may need to also check if any specific features are supported.

bool QCameraFocus::isFocusModeSupported(FocusModes mode) const

Returns true if the focus mode is supported by camera.

bool QCameraFocus::isFocusPointModeSupported(FocusPointMode mode) const

Returns true if focus point mode is supported.

qreal QCameraFocus::maximumDigitalZoom() const

Returns the maximum digital zoom

This will be 1.0 on cameras that do not support digital zoom.

void QCameraFocus::maximumDigitalZoomChanged(qreal zoom) [signal]

Signal emitted when the maximum supported digital zoom value changed.

The maximum supported zoom value can depend on other camera settings, like capture mode or resolution.

qreal QCameraFocus::maximumOpticalZoom() const

Returns the maximum optical zoom.

This will be 1.0 on cameras that do not support optical zoom.

void QCameraFocus::maximumOpticalZoomChanged(qreal zoom) [signal]

Signal emitted when the maximum supported optical zoom value changed.

void QCameraFocus::zoomTo(qreal optical, qreal digital)

Set the camera optical and digital zoom values.

Since there may be a physical component to move, the change in zoom value may not be instantaneous.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web