IDS peak AFL v1.8.0
Loading...
Searching...
No Matches
Peak search algorithm

Focus search algorithms for optimal focus positioning. More...

Enumerations

enum  peak_afl_controller_algorithm {
  PEAK_AFL_CONTROLLER_ALGORITHM_AUTO , PEAK_AFL_CONTROLLER_ALGORITHM_GOLDEN_RATIO_SEARCH , PEAK_AFL_CONTROLLER_ALGORITHM_HILL_CLIMBING_SEARCH , PEAK_AFL_CONTROLLER_ALGORITHM_GLOBAL_SEARCH ,
  PEAK_AFL_CONTROLLER_ALGORITHM_FULL_SCAN
}
 Focus search algorithms. More...
 

Functions

PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_IsSupported (peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
 Check if setting an algorithm is supported for a controller.
 
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Set (peak_afl_controller_handle controller, peak_afl_controller_algorithm algorithm)
 Set the used algorithm for a controller.
 
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Get (peak_afl_controller_handle controller, peak_afl_controller_algorithm *algorithm)
 Get the used algorithm for a controller.
 
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_GetList (peak_afl_controller_handle controller, peak_afl_controller_algorithm *typeList, uint32_t *listSize)
 Get the list of supported algorithms for a controller.
 

Detailed Description

Focus search algorithms for optimal focus positioning.

Sets the algorithm for the maximum value search.

Note
If no maximum value can be found after 300 iterations, the search is aborted and the focus value is reset to the previous value.

Enumeration Type Documentation

◆ peak_afl_controller_algorithm

Focus search algorithms.

Defines the search algorithms used by auto focus controllers to find the optimal focus position. Different algorithms offer trade-offs between speed, accuracy, and reliability in various conditions.

Note
Algorithm availability may depend on camera capabilities
See also
peak_afl_AutoController_Algorithm_Set()
peak_afl_AutoController_Algorithm_Get()
peak_afl_AutoController_Algorithm_IsSupported()
Enumerator
PEAK_AFL_CONTROLLER_ALGORITHM_AUTO 

Automatic algorithm selection.

Default algorithm.

See also
PEAK_AFL_CONTROLLER_ALGORITHM_GOLDEN_RATIO_SEARCH
PEAK_AFL_CONTROLLER_ALGORITHM_GOLDEN_RATIO_SEARCH 

Golden ratio search algorithm.

Uses golden section search to efficiently find the focus peak. Provides fast convergence with good accuracy for most scenes. Requires fewer focus steps than full scan methods.

Note
Fast convergence (typically 8-12 steps)
Good for real-time applications
May struggle with multiple focus peaks or low contrast scenes
PEAK_AFL_CONTROLLER_ALGORITHM_HILL_CLIMBING_SEARCH 

Hill climbing search algorithm.

Iteratively moves focus position toward increasing sharpness values. Good for fine-tuning focus around the optimal position. May get trapped in local maxima with complex scenes.

Note
Good for fine focus adjustments
Fast for small focus corrections
May fail with multiple focus peaks or noisy sharpness curves
PEAK_AFL_CONTROLLER_ALGORITHM_GLOBAL_SEARCH 

Global search algorithm.

Performs a comprehensive search across the focus range to find the global optimum. More robust against local maxima but slower than other methods. Best accuracy for complex scenes.

Note
Highest accuracy and reliability
Handles multiple focus peaks well
Slower than other algorithms (moderate speed)
Best for critical applications where accuracy is paramount
PEAK_AFL_CONTROLLER_ALGORITHM_FULL_SCAN 

Full range scan algorithm.

Scans the entire focus range systematically to build a complete focus curve. Provides maximum accuracy but requires the most time. Ideal for laboratory, calibration, or non-real-time applications.

Note
Maximum accuracy possible
Complete focus characterization across full range
Slowest algorithm (full range scan)
Best for laboratory, calibration, or quality control applications

Function Documentation

◆ peak_afl_AutoController_Algorithm_Get()

PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Get ( peak_afl_controller_handle controller,
peak_afl_controller_algorithm * algorithm )

Get the used algorithm for a controller.

Retrieves the currently configured algorithm that the controller is using for automatic adjustments. This is the same algorithm that was previously set using peak_afl_AutoController_Algorithm_Set.

Parameters
[in]controllercontroller handle
[out]algorithmauto controller algorithm
Returns
PEAK_AFL_STATUS_SUCCESS Operation was successful; no error occurred.
PEAK_AFL_STATUS_NOT_INITIALIZED The library is not initialized.
PEAK_AFL_STATUS_INVALID_PARAMETER The argument is invalid.
PEAK_AFL_STATUS_NOT_SUPPORTED The function is not supported.
PEAK_AFL_STATUS_ERROR An unexpected internal error occurred.
Since
1.0

◆ peak_afl_AutoController_Algorithm_GetList()

PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_GetList ( peak_afl_controller_handle controller,
peak_afl_controller_algorithm * typeList,
uint32_t * listSize )

Get the list of supported algorithms for a controller.

Retrieves all algorithms that are supported by the specified controller. This function allows you to discover which algorithms are available before attempting to configure one. Different controllers may support different sets of algorithms based on their implementation and capabilities.

Uses the Two Staged Data Query principle: call first with NULL to get the required buffer size, then call again with an allocated buffer to retrieve the actual algorithm list.

To set a specific algorithm, see peak_afl_AutoController_Algorithm_Set.

Parameters
[in]controllercontroller handle
[out]typeListPointer to a user allocated list of peak_afl_controller_algorithm. If this parameter is NULL, listSize will contain the needed count of typeList.
[in,out]listSize
Returns
PEAK_AFL_STATUS_SUCCESS Operation was successful; no error occurred.
PEAK_AFL_STATUS_NOT_INITIALIZED The library is not initialized.
PEAK_AFL_STATUS_INVALID_PARAMETER The argument is invalid.
PEAK_AFL_STATUS_BUFFER_TOO_SMALL The supplied buffer is too small.
PEAK_AFL_STATUS_NOT_SUPPORTED The function is not supported.
PEAK_AFL_STATUS_ERROR An unexpected internal error occurred.
Since
1.0

◆ peak_afl_AutoController_Algorithm_IsSupported()

PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_IsSupported ( peak_afl_controller_handle controller,
peak_afl_BOOL8 * supported )

Check if setting an algorithm is supported for a controller.

If supported is PEAK_AFL_TRUE algorithm is supported, otherwise it is unsupported.

Call peak_afl_AutoController_Algorithm_GetList to get a list of supported algorithms.

Parameters
[in]controllercontroller handle
[out]supportedboolean if controller supports setting an algorithm
Returns
PEAK_AFL_STATUS_SUCCESS Operation was successful; no error occurred.
PEAK_AFL_STATUS_NOT_INITIALIZED The library is not initialized.
PEAK_AFL_STATUS_INVALID_PARAMETER The argument is invalid.
PEAK_AFL_STATUS_ERROR An unexpected internal error occurred.
Since
1.0

◆ peak_afl_AutoController_Algorithm_Set()

PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Set ( peak_afl_controller_handle controller,
peak_afl_controller_algorithm algorithm )

Set the used algorithm for a controller.

Configures the algorithm that the controller will use for automatic adjustments. Different algorithms may provide different performance characteristics, accuracy, or speed. The choice of algorithm can significantly impact the controller's behavior and the quality of automatic adjustments.

The available algorithms depend on the controller type and implementation. To get a list of supported algorithms for this controller, call peak_afl_AutoController_Algorithm_GetList first.

Parameters
[in]controllercontroller handle
[in]algorithmauto controller algorithm
Returns
PEAK_AFL_STATUS_SUCCESS Operation was successful; no error occurred.
PEAK_AFL_STATUS_NOT_INITIALIZED The library is not initialized.
PEAK_AFL_STATUS_INVALID_PARAMETER The argument is invalid.
PEAK_AFL_STATUS_NOT_SUPPORTED The function is not supported.
PEAK_AFL_STATUS_ERROR An unexpected internal error occurred.
Since
1.0