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.
| Stage | What the camera does | Typical behavior |
|---|---|---|
| Start | Reads focus value at current position | Single measurement |
| Direction test | Moves lens slightly and compares values | Guesses direction from the change |
| Coarse search | Moves in large steps while contrast rises | Fast travel toward the peak |
| Overshoot | Detects that contrast has started falling | Lens passes the best point |
| Fine search | Steps back in small increments | Visible back-and-forth wobble |
| Lock | Stops at the highest measured value | Confirmation signal or frame |
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.
| Parameter | Effect on autofocus | Practical consequence |
|---|---|---|
| Sensor readout rate | More focus samples per second | Higher frame rates speed up the search |
| Lens motor type | Stepping and linear motors respond fastest | Older gear-driven lenses hunt longer |
| Subject contrast | Low contrast gives a flat focus curve | Blank walls and sky often fail |
| Light level | Noise masks fine detail | Hunting increases in dim scenes |
| AF area size | Small areas pick exact detail | Too small an area may miss texture |
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.
| Property | Contrast detection AF | Phase detection AF |
|---|---|---|
| Direction information | None, found by trial | Measured directly |
| Speed | Slower, iterative | Fast, often one move |
| Accuracy on static subjects | Very high | High, may need calibration in DSLRs |
| Moving subjects | Weak, tends to lag | Strong, supports prediction |
| Video behavior | Visible wobble at lock | Smooth, direct transitions |
| Hardware needs | Only the image sensor | Dedicated or on-sensor AF pixels |
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.
| Situation | Why contrast detection helps | Recommended practice |
|---|---|---|
| Tripod landscapes | Exact focus on chosen detail | Use a small AF point on textured detail |
| Product and still life | Static subjects tolerate slower lock | Pair with magnified live view |
| Fast aperture lenses | Avoids calibration shifts at f/1.4 | Confirm with focus peaking if needed |
| Compact cameras and phones | No room for separate AF modules | Usually combined with other AF data |
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.