Edit page History How do I edit this website?


SimpleAutofocus Manual

The SimpleAutofocus device adapter is deprecated. Please use the modern Autofocus interface instead.

The C++ SimpleAutofocus Device Adapter, written by Karl Hoover, is a higher-performance version of the image-based autofocus function. It builds on the search and sharpness measures in the Java image-based autofocus kindly provided by Pakpoom Subsoontorn & Hernan Garcia. It provides some additional conveniences, for example, the user can over-ride the current acquisition binning and exposure. Multiple search algorithms can be selected. Multiple sharpness metrics are computed.

Refer to Pakpoom Subsoontorn’s write-up for an explanation of the Threshold and Crop Ratio parameters, as those function exactly as described there.

Binning: If this value is not 0, Simple Autofocus will acquire images binned (down-sampled) per the specified setting.

Channel: If this is not blank this is the channel with which the autofocussing will be carried out. You could conceivably wish to switch to, one acquisition channel whilst in the middle of acquiring another channel. If this is blank, the autofocus will use the current instrument settings.

CoarseStepSize: In the BruteForce search method, this is the distance stepped in Z in the first pass search.

CoarseSteps: In the BruteForce Search method, this is the number of steps taken above and also below the current position. Thus, your entire search range is specified to be [CurrentZ - CoarseStepSize*CoarseSteps, CurrentZ + CoarseStepSize*CoarseSteps] The total coarse steps in the BruteForce search is 2*CoarseSteps+1

FineStepSize: In the BruteForce method, the is the Z step size in the second pass

FineSteps: In the BruteForce method, this is the number steps taken above and also the best focus position found in the first (coarse) pass.

Exposure: If this value is not 0, SimpleAutofocus uses this exposure for image acquisition, it is 0, the current acquisition Exposure time is used.

EnableAutoshutter: If this is 1, the shutter is closed between Autofocus image acquisitions, this setting is independent of the on-going acquisition sequence setting.

Mean: This displays the mean image value in the crop region.

Re-acquire&EvaluateSharpness: Set this to 1 to trigger the adapter to acquire a fresh image and calculate the sharpness score at the current position and acquisition settings.

SearchAlgorithm: Select the algorithm for finding the best sharpness measure. Thus far there are BruteForce and Brent. For BruteForce, use a two pass linear search with parameters described as above. For Brent, use Brent’s derivative-less optimization algorithm on the same search range that BruteForce is configured to use, [CurrentZ - CoarseStepSize*CoarseSteps, CurrentZ + CoarseStepSize*CoarseSteps]

StandardDeviation/Mean: This is another popular measure of ImageSharpness which is much cheaper to calculate than the SharpnessScore. Usually SharpnessScore and StandardDeviation/Mean agree very well.

SharpnessScore: This is calculated per image-based autofocus described by Pakpoom Subsoontorn & Hernan Garcia, however, the image is first normalized by the mean. This greatly reduces effects of photo-bleaching on the focus score.

If debug log is ON, you can also see the dynamic range of the normalized image. This is also very strongly dependent on the focus.