Autofocus Algorithms: Phase Detection, Subject Recognition and Predictive Tracking

Autofocus systems combine measurements, algorithms and lens actuation to keep a subject in focus. Phase detection estimates the direction and magnitude of focus error; contrast detection evaluates image sharpness; subject recognition identifies objects or people that the camera should prioritise; predictive tracking estimates where a moving subject will be. Modern cameras may combine these techniques, but “AI autofocus” is not a single standard algorithm.

For the underlying phase-detection process and its test method, see our guide to phase-detection autofocus.

Detection, selection and tracking are separate stages

Detection identifies a possible subject or feature. Selection decides which detected subject should receive focus priority. Tracking maintains that target across frames, while the lens-control loop moves the focus group. A system may detect a face correctly yet lose focus because the lens cannot respond quickly enough or the subject is obscured.

Where machine learning can help

Machine-learning models can classify subjects and identify features such as eyes, animals or vehicles. The camera then combines this information with focus measurements, movement estimates and user settings. Supported subject categories and behaviour depend on the exact body and firmware.

For a current manufacturer example of phase-hybrid autofocus and subject recognition, see Panasonic’s explanation of Phase Hybrid AF and subject recognition.

Firmware can affect autofocus features and compatibility; see our guide to professional camera firmware.

For a complementary discussion of camera-based subject detection and practical evaluation, see AI autofocus systems.

Failure cases to test

  • Subject moves behind an obstruction.
  • Multiple similar subjects cross the frame.
  • Subject is backlit, low contrast or partially obscured.
  • Movement changes speed or direction unexpectedly.
  • Subject leaves and re-enters the selected area.
  • Lens focus motor or communication limits response.

Controlled evaluation

Use a repeatable target path and lighting, record the camera, lens and firmware, and define what counts as a focus hit. Measure acquisition time, tracking success, focus error, reacquisition time and failure rate. Repeat with different subject classes and movement speeds. Do not publish tracking percentages without the sample set and test method.

Conclusion

Autofocus performance depends on the interaction of detection, selection, prediction, sensor readout and lens actuation. Machine learning can improve subject recognition, but it does not guarantee focus. Compare exact camera systems through repeatable tests that include failure conditions.