![]() |
IDS peak AFL v2.0.0
|
Basic automatic focus controller implementation. More...
#include <peak_afl/pipeline/modules/controllers/peak_afl_basic_auto_focus.hpp>
Public Member Functions | |
| BasicAutoFocus (peak::afl::Manager &manager) | |
| Constructs a BasicAutoFocus controller. | |
| ~BasicAutoFocus () override=default | |
| Destructor. | |
| void | SetMode (ControllerMode mode) override |
| Sets the operating mode of the auto-focus controller. | |
| ControllerMode | GetMode () const override |
| Gets the current operating mode of the auto-focus controller. | |
| bool | IsRunning () const override |
| Checks if the auto-focus controller is currently running. | |
| void | ResetToDefault () override |
| Resets all controller parameters to their default values. | |
| void | SetSkipFrames (uint32_t value) |
| Sets the number of frames to skip during auto-focus operations. | |
| uint32_t | GetSkipFrames () const |
| Gets the current number of frames being skipped. | |
| peak::common::RangeU | GetSkipFramesRange () const |
| Gets the valid range for the skip frames parameter. | |
| void | SetHysteresis (uint8_t value) |
| Sets the hysteresis value for focus operations. | |
| uint8_t | GetHysteresis () const |
| Gets the current hysteresis value. | |
| peak::common::RangeU8 | GetHysteresisRange () const |
| Gets the valid range for the hysteresis parameter. | |
| void | SetSharpnessAlgorithm (FocusSharpnessAlgorithm algorithm) |
| Sets the sharpness algorithm used for focus quality evaluation. | |
| FocusSharpnessAlgorithm | GetSharpnessAlgorithm () const |
| Gets the current sharpness algorithm. | |
| void | SetSearchAlgorithm (FocusSearchAlgorithm algorithm) |
| Sets the search algorithm used for finding the optimal focus position. | |
| FocusSearchAlgorithm | GetSearchAlgorithm () const |
| Gets the current search algorithm. | |
| void | SetFocusLimit (const peak::common::Interval &limit) |
| Sets the focus limit range for auto-focus operations. | |
| peak::common::Interval | GetFocusLimit () const |
| Gets the current focus limit range. | |
| void | SetWeightedROIs (const std::vector< WeightedROI > &rois) |
| Sets the weighted regions of interest (ROIs) for focus evaluation. | |
| std::vector< WeightedROI > | GetWeightedROIs () const |
| Gets the current weighted regions of interest. | |
| void | ResetWeightedROIs () const |
| Resets the weighted roi to a single center ROI. | |
| IController::FinishedCallbackHandle | RegisterFinishedCallback (const IController::FinishedCallback &callback) |
| Registers a callback function to be called when focus operations complete. | |
| void | UnregisterFinishedCallback (IController::FinishedCallbackHandle callbackHandle) |
| Unregisters a previously registered finished callback. | |
| Public Member Functions inherited from IController | |
| virtual | ~IController ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| IController (const IController &)=delete | |
| Copy constructor deleted to prevent copying. | |
| IController & | operator= (const IController &)=delete |
| Copy assignment deleted to prevent copying. | |
| IController (IController &&)=delete | |
| Move constructor deleted to prevent moving. | |
| IController & | operator= (IController &&)=delete |
| Move assignment deleted to prevent moving. | |
Additional Inherited Members | |
| Public Types inherited from IController | |
| using | FinishedCallback |
| Callback function type for operation completion notifications. | |
| using | FinishedCallbackHandle |
| Handle type for managing callback registrations. | |
| Protected Member Functions inherited from IController | |
| peak::afl::Manager & | GetManager () |
| Gets a reference to the API manager. | |
Basic automatic focus controller implementation.
The BasicAutoFocus class provides a streamlined interface for automatic focus control. This controller offers essential focus adjustment capabilities with simplified configuration options suitable for most standard focusing requirements.
Key Features:
Focus Algorithms:
Sharpness Measurement:
|
inlineexplicit |
Constructs a BasicAutoFocus controller.
| manager | Reference to the API manager instance that will manage this controller. The manager must remain valid for the lifetime of this controller. |
|
overridedefault |
Destructor.
Cleans up resources and ensures proper shutdown of the auto-focus controller.
|
inline |
Gets the current focus limit range.
|
inline |
Gets the current hysteresis value.
|
inline |
Gets the valid range for the hysteresis parameter.
|
inlineoverridevirtual |
Gets the current operating mode of the auto-focus controller.
Implements IController.
|
inline |
Gets the current search algorithm.
|
inline |
Gets the current sharpness algorithm.
|
inline |
Gets the current number of frames being skipped.
|
inline |
Gets the valid range for the skip frames parameter.
|
inline |
Gets the current weighted regions of interest.
|
inlineoverridevirtual |
Checks if the auto-focus controller is currently running.
Implements IController.
|
inline |
Registers a callback function to be called when focus operations complete.
The callback will be invoked when the auto-focus operation finishes, whether it succeeds or fails. This allows for asynchronous monitoring of focus operations.
| callback | Function object to be called upon focus operation completion. The callback should accept parameters indicating the operation result. |
|
inlineoverridevirtual |
Resets all controller parameters to their default values.
This method restores the controller to its initial configuration, resetting all settings including skip frames, hysteresis, algorithms, focus limits, and ROIs to their default values.
Implements IController.
|
inline |
|
inline |
Sets the focus limit range for auto-focus operations.
The focus limit constrains the auto-focus system to operate within a specified range of focus positions, preventing it from searching across the entire focus range.
| limit | Interval defining the minimum and maximum focus positions that the auto-focus system is allowed to use. |
|
inline |
Sets the hysteresis value for focus operations.
Hysteresis prevents oscillation around the focus point by requiring a minimum change in focus quality before triggering a focus adjustment. Higher values provide more stability but may reduce responsiveness.
| value | Hysteresis value (0-255). Higher values increase stability but may reduce focus sensitivity. |
|
inlineoverridevirtual |
Sets the operating mode of the auto-focus controller.
| mode | The desired controller mode (e.g., Off, On, Auto, Manual). See ControllerMode enumeration for available options. |
Implements IController.
|
inline |
Sets the search algorithm used for finding the optimal focus position.
The search algorithm determines the strategy used to find the best focus position, such as hill climbing, binary search, or full sweep approaches.
| algorithm | The search algorithm to use for focus positioning. See FocusSearchAlgorithm enumeration for available options. |
|
inline |
Sets the sharpness algorithm used for focus quality evaluation.
The sharpness algorithm determines how focus quality is measured from the image data. Different algorithms may perform better under different lighting conditions or with different scene content.
| algorithm | The sharpness algorithm to use for focus evaluation. See FocusSharpnessAlgorithm enumeration for available options. |
|
inline |
Sets the number of frames to skip during auto-focus operations.
Frame skipping can be used to reduce computational load by processing only every nth frame during focus operations.
| value | Number of frames to skip between focus evaluations. Must be within the valid range returned by GetSkipFramesRange(). |
|
inline |
Sets the weighted regions of interest (ROIs) for focus evaluation.
Weighted ROIs allow the auto-focus system to prioritize certain areas of the image when determining focus quality. Each ROI has an associated weight that influences its contribution to the overall focus metric.
| rois | Vector of weighted ROI objects defining the regions and their relative importance for focus evaluation. An empty vector will use the entire image for focus evaluation. |
|
inline |
Unregisters a previously registered finished callback.
| callbackHandle | Handle returned by RegisterFinishedCallback() that identifies the callback to be removed. |