Universal Auto Focus Plug-in

Introduction

The Universal Auto Focus Plug-in allows manual and automatic control of a Auto Focus (AF) actuator. You select the actuator type, and then selects options as to limits and features to exercise the actuator.

It is assumed that you have general knowledge of DevWare and its plug-ins, as well as basic knowledge of AF actuators and methods.

Basic Operation

Here's what the plug-in looks like upon first launch within DevWare.

 

The Plug-in is organized by major functional areas, each separated by a line the runs the width of the plug-in.

Actuator and Focus Type Selection

The first area lets you select the actuator ("IC Driver"), the type of AF to use ("Focus Types"), as well as associated parameters.

  • IC Driver; this pull-down is populated based on the attached sensor. For example, if the sensor has an Internal VCM then that driver will be available.
    Use the pull-down to select the actuator type of the attached module.
    Note: there is no method of auto-detecting the actuator type - you must know this.
  • Focus Types; this pull-down allows you to select the plug-in function.
    Note: fields will be enabled/disabled based on your selection - these are described below.
    • Manual; allows for manual movement of the actuator via the slider bar.
    • Auto - Full Scan; will automatically find the best focus position thru the range as defined by "Min" and "Max".
      This is the simplest method of finding the best focus position, but takes longer as it checks all available positions.
    • Auto - Fast Focus; will do a curve-fit to find the best focus position starting at "Min".
      It works by moving the lens and keeping track of the Sharpness scores; once the score goes up and then starts going down, it stops and using the scores produces a "curve" and selects the top of the curve.
    • IC Driver Direct Reg Access; allows you to access actuator register(s).
    • Capture Frames; starting at "Min" and ending at "Max", position the actuator and capture an image for the number in "1st Scan".
    • PDAF; uses the Phase Differential method to find the best focus position.
      Only works with sensors that have PDAF enabled, and requires calibration within DevWare's PDAF dialog - those instructions are provided below under "PDAF Calibration".
  • Steps - 1st Scan; sets the number of steps used for Full Scan, Fast Focus, and Capture Frames.
  • Steps - 2nd Scan; set the number of steps used after Full Scan or Fast Focus finds the initial focal position.
    This provides a faster method of find the very best focus position taking the 1st Scan results and doing additional steps surrounding it.
  • Steps - Macro Mode; for Full Scan and Fast Focus, sets the initial position not a "Min" but at the "Macro" position.
    For times when the module is very close to subject - avoids trying focus positions that are known not to be the best Sharpness score.
  • Physical Min/Max; the physical minimum and maximum to be used for the actuator.
    These are sometimes not the true min/max since the actuator itself my only move at lesser amounts; for example, the actuator may only start moving at 100 not 0, and stop at 900 and not 1023.
  • Other Settings - Slew Rate; for actuators that have this value, set the amount of slew.
  • Other Settings - Skip Frames; number of frames to skip before calculating the next Sharpness score - a lower number means faster completion of auto functions.
    • If too low a number is selected the automated Focus Types may not work due to too-little time allowed for the actuator to finish moving.

Slider Bar and Trigger Selection

The second area lets you manually move the actuator position in manual mode, and in other modes "Trigger" the start of the Focus Type.

The area directly below the Slider bar is used to display various status and progress messages; upon first launch, it displays "Slider bar is active.".

  • In Manual mode, the slider bar allows quick movement of the actuator.
    • When the slider bar indicator is selected, left and right arrow buttons will move the actuator 1 value, and page up/down move the actuator by 20 values.
    • A position can be entered directly in the "Slider Pos" field, and then used by selecting "Trigger".
  • Sharpness score; displays the calculated sharpness score of the image - the higher the number, the more in-focus the image.
    • Displayed during Manual and other actuator-moving Focus Types.

I2C Base Selection

The third area lets you set the base I2C address of the actuator, and depending on the actuator type will let you set / get register values.

Miscellaneous Selection

The fourth area has some miscellaneous items that be enabled/disabled.

  • Disable Internal VCM; only enabled for sensors with this feature, it turns off the actuator as this can sometimes distort the image.
  • Show AF Region; places an overlay on the displayed image indicating the area used to calculate the Sharpness score - the center 50% of the image.
  • Reduce Region; reduces the AF Region from 50% to 25%

Logging Selection

The fifth area enables logging of the actuator movement for each step and its associated Sharpness score.

  • Only available for Full Scan, Fast Focus, Capture Frames, and PDAF.
  • To use, first select the location and name of the CSV file to be generated, then select "Enable Logging" and then "Trigger" to start the process.
  • To close the file for viewing, deselect "Enable Logging".

User Guide

Select the "User Guide" button to open the Web-based User Guide documentation.

PDAF Calibration

Use the following instructions to calibrate DevWare processing of the PDAF data when using a PDAF-enabled module.

  1. Position the sensor at the distance you consider "infinite" (usually about 2 feet or so) so the lens is "in focus".
  2. Enable PDAF data on the sensor via the appropriate INI preset, and then open the PDAF dialog and enable "Overall Defocus Position" (blue arrow).
    Also, set the "Coefficient" to -40.0 as this empirically appears to be a decent value.

     
  3. On the main image at the bottom, you should now see the position indicator bar.

    The red circle indicates the current location (the green bubble) of "in focus" for the position bar, and the green circle is where you need to adjust that to (white diamond).
  4. Using the "Offset" value in the PDAF dialog, adjust it so the green bubble in on the white diamond.

Related pages