IDS peak AFL v1.7.0
Loading...
Searching...
No Matches
Auto focus

Topics

 Skip frames
 
 Hysteresis
 
 Limit
 
 Weighted region of interest
 
 Region of interest presets
 
 Sharpness algorithm
 
 Mode
 
 Peak search algorithm
 
 Callbacks
 

Detailed Description

Auto focus

The autofocus controller will automatically adjusts the lens to focus on a subject.

Enabling and automatically disabling the control function

For ongoing adaptations the Continuous mode has to be used so that it responds to deviations from the target value. To disable the control functionality automatically once the target value has been reached, (approximately) use the Once mode.

Configuring the control functions

Skip frames

The Skip frames setting defines how many frames should be skipped. This parameter strongly influences the control speed. Choosing small values can destabilize the automatic control.

Note
For higher frame rates, a larger value should be used for the Skip frames parameter. This reduces the number of automatic adjustments done by the camera.

Hysteresis

Defines the size of the interval range after which the algorithm terminates the search.

Limit

With the minimum and maximum limit the focus search range for the focus_algorithm can be limited. The focus_limit affects whether and where a maximum value is found.

Weighted region of interest

The Weighted Region of Interest (Weighted ROI) is a concept to prioritize certain areas of an image over others. In the context of autofocus systems, the Weighted ROI is used to assign more importance to specific regions of the image, such as where the main subject is likely located, to ensure optimal focus.

Note
  • Depending on the acquisition conditions, several "sharpness maximum values" may be possible in the ROI. This may result in an error in control, especially with Continuous mode.
  • Small ROIs can cause the focus to fluctuate constantly so that an optimal focus cannot be found.

Region of interest preset

TODO

Sharpness algorithm

Sets the algorithm for the sharpness calculation.

Peak search algorithm

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.

Callback

It is possible to be informed for specific events via callbacks. The following callbacks are available:

Note
The Finished callback will only be called when the controller runs in Once mode.

Examples

Note
For the automatic host control to work, the frames must be transferred to the manager. To reduce and simplify the sample code, the examples do not check the return values.
peak_afl_AutoFeatureManager_Create(&hManager, nodemapHandle);
// create a focus controller within our manager
peak_afl_controller_handle hController = 0;
// run in continuous mode
// submit the images
while (acquisitionRunning)
{
peak_afl_AutoFeatureManager_Process(hManager, imageHandle);
}