Contrast detection AF

On this page 7

Contrast detection AF is an autofocus method that finds focus by maximizing image contrast measured directly on the imaging sensor. In focus and autofocus for photography, it works by moving the lens in small steps, measuring how sharp the selected area appears at each position, and stopping at the position where local contrast reaches its peak.

Because it evaluates the actual image formed on the main sensor, contrast detection is highly accurate and free of calibration errors, but it has no direct information about which way or how far focus must move. That missing information makes it slower and prone to hunting compared with phase detection AF.

How contrast detection AF finds focus

Contrast detection relies on a simple optical fact: a sharply focused image contains the strongest fine detail, and therefore the largest brightness differences between neighboring pixels. The camera computes a focus value, usually a sum of high-frequency components or gradient magnitudes in the AF area, for each lens position.

The process is a search algorithm. The camera does not know whether focus lies nearer or farther, so it must test and compare. The table shows the typical stages.

StageWhat the camera doesTypical behavior
StartReads focus value at current positionSingle measurement
Direction testMoves lens slightly and compares valuesGuesses direction from the change
Coarse searchMoves in large steps while contrast risesFast travel toward the peak
OvershootDetects that contrast has started fallingLens passes the best point
Fine searchSteps back in small incrementsVisible back-and-forth wobble
LockStops at the highest measured valueConfirmation signal or frame
Stages of a contrast detection focus cycle

The overshoot and return is unavoidable in pure contrast detection, because the peak can only be recognized after the lens has moved past it. This behavior is what photographers and videographers see as focus hunting or breathing wobble.

Factors that affect speed and reliability

Contrast detection performance depends on how quickly the sensor can be read and how quickly the lens can move. A faster sensor readout delivers more focus measurements per second, and a lens with a fast, quiet focus motor can follow the algorithm without delay.

ParameterEffect on autofocusPractical consequence
Sensor readout rateMore focus samples per secondHigher frame rates speed up the search
Lens motor typeStepping and linear motors respond fastestOlder gear-driven lenses hunt longer
Subject contrastLow contrast gives a flat focus curveBlank walls and sky often fail
Light levelNoise masks fine detailHunting increases in dim scenes
AF area sizeSmall areas pick exact detailToo small an area may miss texture
Parameters that influence contrast detection AF

In good light with a modern mirrorless body and lens, contrast detection can lock in a fraction of a second for static subjects. In dim interiors or with low-contrast subjects, the focus curve becomes flat and noisy, and the system may search through its full range before giving up.

Contrast detection compared with phase detection

The main alternative is phase detection AF, which splits light into two views and measures their offset. That offset tells the camera both the direction and the amount of defocus in one measurement, so the lens can drive straight to focus.

PropertyContrast detection AFPhase detection AF
Direction informationNone, found by trialMeasured directly
SpeedSlower, iterativeFast, often one move
Accuracy on static subjectsVery highHigh, may need calibration in DSLRs
Moving subjectsWeak, tends to lagStrong, supports prediction
Video behaviorVisible wobble at lockSmooth, direct transitions
Hardware needsOnly the image sensorDedicated or on-sensor AF pixels
Contrast detection and phase detection AF

Most current mirrorless cameras use hybrid autofocus: on-sensor phase detection pixels bring the lens close to focus quickly, and contrast measurement refines the final position. This combination joins the speed of phase detection with the precision of contrast detection, and it underpins features such as Eye AF and subject tracking.

Where contrast detection AF remains useful

Pure contrast detection is still used where precision matters more than speed. It measures focus at the sensor plane itself, so it is immune to the front focus and back focus errors that affected DSLR phase detection modules.

SituationWhy contrast detection helpsRecommended practice
Tripod landscapesExact focus on chosen detailUse a small AF point on textured detail
Product and still lifeStatic subjects tolerate slower lockPair with magnified live view
Fast aperture lensesAvoids calibration shifts at f/1.4Confirm with focus peaking if needed
Compact cameras and phonesNo room for separate AF modulesUsually combined with other AF data
Situations suited to contrast detection

For action, sports and wildlife, contrast-only systems are a poor match, because the subject distance changes during each search cycle. Photographers using such cameras often pre-focus manually on the expected position of the subject instead.

Common problems and how to avoid them

  • Hunting in low light: switch to a larger AF area, add light, or use the AF assist lamp.
  • Failure on plain surfaces: place the AF point on an edge or texture at the same distance.
  • Wobble in video: use phase detection or hybrid AF, or focus manually with peaking.
  • Focus on the background: reduce AF area size so that the subject dominates the measurement.
  • Stripes and repeating patterns: these can create false peaks, so verify with magnification.

A non-technical view

Contrast detection autofocus works the way a person adjusts binoculars. You turn the wheel, notice whether the view gets sharper or blurrier, go a bit too far, then turn back to the sharpest point.

The camera does the same thing very quickly by checking how crisp the edges in the picture look. It is very accurate when nothing moves, but it takes a moment and can wander back and forth, which is why it struggles with fast action.

A concrete example

A product photographer shoots a wristwatch for an online catalog with the camera on a tripod, a 90 mm macro lens at f/8 and continuous LED light. The depth of field at this distance is only a few millimeters, so focus must land exactly on the watch hands.

She switches the camera to single-point contrast detection and places a small AF point on the edge of the minute hand. The lens moves past the peak and settles back in under a second, and a magnified check confirms crisp markings. Every frame in the series is focused on the same detail, which removes reshoots caused by slight focus misses.