How do digital cameras focus by me just holding down one button?


How do digital cameras focus by me just holding down one button?

In: Engineering

They analyze the data coming from the sensor and adjust the focus until they get the clearest image.

When you’re out of focus, the level of similarity between pixels is high, as the image comes into focus, the similarity between pixels drops. The camera adjusts the lens until it finds the point with the lowest similarity between pixels.

there is a software running in the camera which scans the fokus and tries to find the setting with the sharpest edges on the sensor. This only works if you have sharp edges on the object you want to photograph. try an autofokus on something smooth, and it will fail.

A program in the camera divides the image into areas (in better cameras you can manually define the areas to be evaluated) and evaluate the pixels for sharp color changes – when you have as many nearby pixels with extremely different color values.

The software keeps moving the lens back and forth until it gets in most areas the most differentiated color values.

There are different ways a digital camera does this.
The most popular method is “contrast autofocus”.

With contrast AF the camerasoftware evaluates how sharp the image is. Then the camera focuses a bit and checks again if the image got sharper. So it’s basically the camera cleverly focusing around until the software says “stop here, this was the sharpest image I have seen”. The software detects sharpness by measuring the contrast. The higher the contrast, the sharper the image.

An other method is “phase autofocus”. While contrast AF is cheap since it only requires software, phase AF requires an additional sensor, making it more expensive and therefore less widespread. But it has some benefits over contrast AF.

The phase AF system uses a clever optical mechanism to project the desired image section multiple times on the additional sensor. The clever part is, that the projected images are further away from each other on the sensor the more the real image section is away from being at focus distance. So the image distance on the sensor is a measurement of the defocus. This way the camera immediately knows how much and in which direction it has to adjust the focus. Without trying around.

Phase AF is often found in expensive premium cameras.

Edit: typo; typo