Autofocus

How Does Autofocus Work?

How Does Autofocus Work?

Autofocus (AF) is the system that helps a camera make a chosen subject look sharp. It evaluates focus information, moves the lens's focusing elements, and checks or updates the result. Most modern digital cameras rely on phase-detection autofocus, contrast-detection autofocus, or a combination of the two. Smartphones use many of the same optical principles, often with subject-recognition software and, on some models, distance sensors.

Understanding how autofocus works makes it easier to choose the right focus mode, photograph moving subjects, and work out why an otherwise well-exposed image looks blurry.

What Happens When a Camera Autofocuses?

Although the details vary by camera, a typical autofocus sequence has four parts:

  1. Select the target: The camera uses your chosen focus area or subject-recognition settings to decide what it should try to keep sharp.
  2. Measure focus: Its autofocus system analyzes incoming light or focus-related sensor data to determine whether the target is in focus.
  3. Move the lens: A focusing motor changes the position of optical elements so the subject's image forms sharply at the sensor.
  4. Confirm or update: The system may verify focus or continue adjusting it as the subject moves, depending on the camera and AF mode.

Recognizing an eye and focusing on that eye are related but different jobs. Subject recognition tells the camera where to focus; the autofocus system still has to move the optics to the correct distance. A camera can recognize a face and still take a soft photo if the lens cannot keep up, the subject moves during exposure, or the depth of field is too shallow.

Active vs. Passive Autofocus

Passive autofocus works with light already entering the camera lens. Phase detection and contrast detection are its two principal methods. They are widely used in digital cameras and smartphones.

Active distance measurement sends out a signal, such as infrared light or a laser, and uses the return signal to estimate subject distance. Some camera systems use this information to assist focusing, particularly when image detail is difficult to analyze. Active ranging does not always replace the camera's main autofocus method, and results can depend on distance, surface reflectivity, and obstructions.

The distinction is useful, but photographers generally have more control over the focus mode and focus area than over the underlying detection method.

How Contrast-Detection Autofocus Works

Contrast-detection AF looks at differences between neighboring light and dark details in the image. As the lens approaches correct focus, edges typically become more distinct and measurable contrast rises. The camera searches for the lens position that produces the strongest relevant contrast.

Its limitation is that a contrast reading alone generally does not reveal which direction the lens needs to move. The system may test different positions, overshoot, and reverse direction. Photographers see this as focus hunting, especially with a plain wall, a dim scene, or a moving subject.

Contrast AF can be accurate for stationary subjects because it evaluates the image at the imaging sensor. However, it is not automatically more accurate than every phase-detection system, and it is not the best choice for every moving subject.

How Phase-Detection Autofocus Works

Phase-detection autofocus (PDAF) compares light information gathered from different portions of the lens's aperture. The difference between the resulting signals indicates whether focus is in front of or behind the intended subject and provides an estimate of how far the focusing elements need to move.

That directional information is the key advantage: instead of searching blindly for a contrast peak, the camera can drive the lens toward the predicted focus position. This makes PDAF particularly useful when subjects change distance quickly, as in sports, wildlife, or children running toward the camera.

Phase detection is not infallible. Low light, repeated patterns, low-texture subjects, obstructions, and lens limitations can still cause errors. For a technical illustration of the underlying principle, see Nikon's explanation of phase-detection and contrast-detection autofocus.

What Is Hybrid Autofocus?

Hybrid AF combines phase-detection and contrast-detection information in a camera system. Depending on the model and shooting conditions, the camera may use phase detection for rapid distance changes, contrast detection where it is helpful, or switch between methods automatically. It is not correct to assume that every hybrid system always uses contrast detection as a final focusing step.

Many mirrorless cameras incorporate phase-detection capability into the image sensor, so autofocus can operate while you compose through the electronic viewfinder or rear screen. Traditional DSLRs often use a separate phase-detection AF sensor when composing through an optical viewfinder, although Live View implementations vary by model.

Dual Pixel Autofocus

Dual Pixel CMOS AF is one implementation of on-sensor phase detection. In Canon's system, individual imaging pixels have two light-sensitive parts whose signals can be compared to calculate focus. This helps the camera make smooth, directional focus adjustments for photographs and video. Read Canon's explanation of Dual Pixel CMOS AF for the sensor-level details.

How Smartphone Autofocus Works

A smartphone usually focuses by physically moving a small lens group, not by digitally sharpening the live preview. Many phones use on-sensor PDAF, including dual-pixel designs. Some models also use laser-based distance information, while software helps select and track a face, eye, object, or tapped location.

Computational photography can improve the final image through processing, and portrait modes can create simulated background blur. Those features are not the same thing as optical autofocus. Likewise, tapping a subject often tells the phone which region to prioritize; it does not guarantee a sharp result in darkness or at a distance closer than the camera can focus.

For example, Google's Pixel Camera focusing instructions explain how tapping a subject and using focus lock can help control the result. The exact controls differ across phone brands and camera apps.

Which Autofocus Mode Should You Use?

Focus modes control when the camera updates focus, while focus areas control where it looks. Names and available features vary by manufacturer.

  • AF-S or One-Shot AF: A practical starting point for stationary portraits, architecture, product photos, and landscapes. On many cameras, half-pressing the shutter acquires and locks focus.
  • AF-C or Servo AF (AI Servo AF on older Canon models): Better suited to changing subject distance, such as sports, birds, pets, and people walking toward you. The camera keeps updating focus while autofocus remains engaged.
  • Eye or subject-detection AF: Helpful for portraits and supported wildlife subjects. Check that the camera is following the intended eye or animal rather than a nearer distraction.
  • Spot or single-point area: Useful when the camera keeps selecting the background, a foreground branch, or the wrong person.
  • Manual focus: Worth trying when autofocus repeatedly selects the wrong plane, especially through glass, in close-up work, or in extremely dark conditions.

Be careful with the traditional focus-and-recompose technique. It can work well for a stationary subject, but a large change in camera angle at a very wide aperture and close distance can shift the important eye outside the sharpest region. Moving the focus point or using eye detection may be more reliable. Also, half-pressing the shutter does not universally lock focus in continuous AF or in customized back-button setups.

Why Autofocus Misses and How to Fix It

  • The camera hunts on a blank or dark subject: Aim the focus area at an edge or textured detail at the same distance. Add light when possible, or use manual focus with magnification if your camera supports it.
  • The wrong object is sharp: Select a smaller focus area or change the subject-detection target. Check for branches, windows, fences, or other foreground objects that may attract focus.
  • Close-up shots never become sharp: You may be inside the lens's minimum focusing distance. Move back slightly or use an appropriate close-focusing or macro mode.
  • The eye is sharp but other facial features are soft: Focus may be correct, but depth of field is too shallow. Try a smaller aperture or increase the camera-to-subject distance.
  • Everything has a directional smear: That is more likely subject motion or camera shake than a focusing failure. Use a faster shutter speed or stabilize the camera, as appropriate. For practical techniques, see how to photograph moving subjects without blur.
  • Phone photos look hazy: Check for fingerprints, condensation, or a dirty lens cover. Clean the glass carefully before changing focus settings.

When checking results, enlarge the captured image rather than judging sharpness only from a small rear-screen preview. If the background is crisp but the subject is soft, suspect missed focus. If sharp features turn into streaks, examine shutter speed and movement first.

A Five-Minute Autofocus Test

You can see the difference between autofocus settings without special equipment:

  1. Place a textured object, such as a book cover, in front of a background several steps farther away. Use steady light and a shutter speed fast enough to avoid camera shake.
  2. Select AF-S or your camera's equivalent and a small focus area. Focus on the book, take a photo, and check the book and background at high magnification.
  3. Switch to AF-C and photograph a person moving slowly toward the camera. Keep autofocus engaged while capturing several frames, then inspect whether the subject stays sharp.
  4. Repeat with a wider automatic focus area and see whether the camera chooses a different target. If it does, that is a focus-area selection problem rather than proof that phase or contrast detection is defective.

This exercise helps separate target selection, focus tracking, depth of field, and motion blur, which often look similar on a small screen.

Can Editing Fix a Photo That Missed Focus?

Sharpening, clarity, and texture adjustments can improve the appearance of detail that was captured, but they cannot reliably restore fine information that was never recorded because focus missed the intended subject. The same limitation applies to Lightroom presets: they can change color and tone, not replace accurate optical focus.

The most dependable workflow is to identify the subject, choose the right focus mode and area, protect the shutter speed, and check sharpness during the shoot. Once the capture is sound, editing can refine the finished photograph without trying to repair a fundamental focusing mistake.

Written by Asanka for AAAPresets.

Reading next

AF-S vs AF-C: What Is the Difference?
Single Autofocus vs Continuous Autofocus: Which One Should You Actually Use?

Leave a comment

This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.