IDS peak AFL v2.0.0
Loading...
Searching...
No Matches
Sharpness algorithm

Sharpness measurement algorithms for focus evaluation. More...

Enumerations

enum  peak_afl_controller_sharpness_algorithm {
  PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_AUTO , PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_TENENGRAD , PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_SOBEL , PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_MEAN_SCORE ,
  PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_HISTOGRAM_VARIANCE
}
 Focus sharpness calculation algorithms. More...

Functions

PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_IsSupported (peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
 Check if setting a sharpness algorithm is supported by a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Set (peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm algorithm)
 Set the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Get (peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *algorithm)
 Get the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_GetList (peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *typeList, uint32_t *listSize)
 Get the list of supported sharpness algorithms for a controller.

Detailed Description

Sharpness measurement algorithms for focus evaluation.

Sets the algorithm for the sharpness calculation.

  • Tenengrad: Sobel factors in x- and y-direction and summation of the euclidean distances.
  • Sobel: Sobel factors in x- and y-direction and summation of the absolute gradient magnitudes.
  • Mean Score: Summation of the difference between two mean values from two pixel values each in x- and y-direction.
  • Histogram Variance: Standard deviation of the gray values in the histogram of the mean value.

Enumeration Type Documentation

◆ peak_afl_controller_sharpness_algorithm

Focus sharpness calculation algorithms.

Defines the mathematical algorithms used to calculate image sharpness for automatic focus control. Different algorithms have varying sensitivity to different types of image content and noise conditions.

See also
peak_afl_AutoController_SharpnessAlgorithm_Set()
peak_afl_AutoController_SharpnessAlgorithm_Get()
Enumerator
PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_AUTO 

Automatic algorithm selection.

Default sharpness algorithm.

Deprecated
This value is deprecated. The automatic selection always defaults to the Tenengrad algorithm. Use PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_TENENGRAD instead.
PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_TENENGRAD 

Tenengrad gradient-based algorithm.

Uses gradient magnitude calculations to measure image sharpness. Effective for images with clear edges and high contrast features. Computationally efficient and works well in most lighting conditions.

Note
Good for high-contrast scenes with clear edges
PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_SOBEL 

Sobel edge detection algorithm.

Uses Sobel edge detection operators to measure sharpness based on edge strength. Particularly effective for images with fine details and textures. More sensitive to noise than Tenengrad.

Note
Best for detailed textures and fine patterns
PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_MEAN_SCORE 

Mean score algorithm.

Calculates sharpness based on statistical measures of image content. Provides stable measurements but may be less sensitive to fine details. Good for consistent performance across varying image content.

Note
Stable performance, less sensitive to noise
PEAK_AFL_CONTROLLER_SHARPNESS_ALGORITHM_HISTOGRAM_VARIANCE 

Histogram variance algorithm.

Uses histogram analysis to measure image sharpness based on intensity distribution variance. Effective for images with good contrast but may be affected by lighting variations.

Note
Good for well-lit scenes with good contrast

Function Documentation

◆ peak_afl_AutoController_SharpnessAlgorithm_Get()

PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Get ( peak_afl_controller_handle controller,
peak_afl_controller_sharpness_algorithm * algorithm )

Get the used sharpness algorithm for a controller.

Retrieves the currently configured sharpness algorithm that the controller is using for focus evaluation. This is the same algorithm that was previously set using peak_afl_AutoController_SharpnessAlgorithm_Set.

Parameters
[in]controllercontroller handle
[out]algorithmauto controller sharpness 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_SharpnessAlgorithm_GetList()

PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_GetList ( peak_afl_controller_handle controller,
peak_afl_controller_sharpness_algorithm * typeList,
uint32_t * listSize )

Get the list of supported sharpness algorithms for a controller.

Retrieves all sharpness algorithms that are supported by the specified controller. This function allows you to discover which sharpness algorithms are available for focus evaluation before attempting to configure one. The available algorithms may vary based on the controller implementation and hardware 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 sharpness algorithm, see peak_afl_AutoController_SharpnessAlgorithm_Set.

Parameters
[in]controllercontroller handle
[out]typeListPointer to a user allocated list of peak_afl_controller_sharpness_algorithm. If this parameter is NULL, listSize will contain the needed count of typeList.
[in,out]listSizeSize of typeList:
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_SharpnessAlgorithm_IsSupported()

PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_IsSupported ( peak_afl_controller_handle controller,
peak_afl_BOOL8 * supported )

Check if setting a sharpness algorithm is supported by a controller.

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

Call peak_afl_AutoController_SharpnessAlgorithm_GetList to get a list of supported sharpness algorithms.

Parameters
[in]controllercontroller handle
[out]supportedboolean if controller supports setting a sharpness 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_SharpnessAlgorithm_Set()

PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Set ( peak_afl_controller_handle controller,
peak_afl_controller_sharpness_algorithm algorithm )

Set the used sharpness algorithm for a controller.

Configures the sharpness algorithm that the controller will use for focus evaluation and automatic focus adjustments. Different sharpness algorithms use different mathematical approaches to measure image sharpness, which can affect focus accuracy and speed in different scenarios.

The choice of sharpness algorithm can be critical for optimal focus performance, especially in challenging lighting conditions or with specific types of subjects.

To get a list of supported sharpness algorithms for this controller, call peak_afl_AutoController_SharpnessAlgorithm_GetList first.

Parameters
[in]controllercontroller handle
[in]algorithmauto controller sharpness 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