Blog home

Categories

How does autofocus work on your smartphone?

abdulf

abdulf

10 minute read

When taking photos on your smartphone, it’s important for them to turn out crisp and clear. For this to happen, images must be focussed before a photo is taken. Recently, a number of mobile manufacturers have tried improving the way auto-focus works on a smartphone. In this article, we look at the three approaches to focussing an image. We’ll also compare the pros and cons of each approach.

Auto-Focus: Keeping Your Photos Crisp & Clear

When choosing a cameraphone, many people simply concentrate on the number of megapixels. With 8.7 megapixels already giving you an A4-sized print, smartphones have arguably now reached the stage where having more megapixels doesn’t mean better quality. Instead, it’s probably more important to look at other factors that can greatly affect the quality of your photos.

In previous blog posts, we looked at two technologies for capturing a photo with better quality on your smartphone. Optical image stabilisation (OIS) gives better-quality photos in low-light conditions. Meanwhile, High Dynamic Range (HDR) gives more detail in photos with large contrast.

Today, we turn our attention to auto-focus on your camera phone. It’s a feature that Apple, Samsung and LG have been trying to innovate on in their latest smartphones. Indeed, auto-focus has even been described as the new megapixel: it’s the next big feature everyone is trying to improve on.

What is Auto-Focus & Why Do We Need It?

lens and sensor autofocus
How autofocus works

When taking photos of an object, your camera phone will capture the light coming from it. A convex lens is used in the camera to focus incoming light onto a CMOS sensor. The sensor will then digitise the light and will turn it into a JPEG photo that’s then saved on your smartphone.

In every digital camera, there’s a lens and a sensor. The lens focuses incoming light onto the sensor in the camera. The sensor then creates a digital photograph from the incoming light.

In the real world, things aren’t quite as simple as in the diagram above. The angle of incoming light rays will depend on the distance to the object being photographed. In the following diagram, we’ve shown a lens which is set up to focus light from a blue object. Unfortunately, the green and red objects are not focussed on the sensor (they instead appear blurred in the final photo).

how fixed focus lense work
Fixed focus lenses

In this example, only the blue ray of light is actually focussed. If we want to focus the green or red rays, we’ll need to change the distance between the lens and the sensor.

In the early days of camera phone technology, most devices had a fixed-focus lens. Because of the fixed-focus lens, it was impossible to capture totally-sharp images. This means a lot of detail was lost (it was one reason why camera phones could easily be beaten by a standalone digital camera).

Nowadays, the majority of smartphones (except some entry-level devices) have adjustable focus on the rear-facing camera. The lens is able to be moved back and forth so to vary the distance between the lens and the sensor. Used together with auto-focus technology, it means you’re able to capture sharper images without blurring on the sensor and loss of detail.

There are currently three different methods for performing auto-focus on a smartphone:

Contrast-detection auto-focus. Used on the majority of smartphones. Phase-detection auto-focus. Used on some newer higher-end devices such as the Galaxy S5, the Galaxy S6, the iPhone 6 and the iPhone 6 Plus. Laser auto-focus. Used on the LG G3 and the LG G4. Ideally, an auto-focus system should be fast and accurate. It should quickly work out where to place the lens in order to capture a focussed and sharp image. The ideal auto-focus system should also work whatever the environment and lighting (e.g. indoors or outdoors, bright or dark conditions).

Contrast-Detection Autofocus: The Standard Method Today

Most smartphones today use a method of auto-focus known as contrast detection. Essentially, it’s an auto-focus system based on trial-and-error. The lens on your camera phone is moved back and forth until the position of maximum focus is found for the object.

In order to determine when an image is in focus, your smartphone uses an algorithm based on measuring the contrast. Generally, the level of contrast will be highest in an image when the object is in focus (the image has a sharp outline and colours are more vivid). If the image is out-of-focus, colours will tend to blur into each other. This means there is a lower level of overall contrast.

The following image illustrates how contrast detection auto-focus works:

how contrast detection autofocus works
Contrast detection autofocus

In contrast-detection auto-focus, your cameraphone will move the lens back and forth until it finds the point of maximum contrast. This will be when the image is in focus.

A major downside when using this method is your phone doesn’t know when it has reached the point of maximum contrast. For this reason, it will always need to go past the focal point before going back to a more focussed image. You’ll sometimes notice this when taking photos on your smartphone: the image will sometimes become blurrier before it gets clearer.

Pros of Contrast-Detection Auto-Focus:

It doesn’t require any extra hardware. A major benefit of contrast-detection auto-focus is it doesn’t require any additional hardware. This makes it a fairly cheap and easy system to implement.

It generally gives fairly good results. Despite being slow, contrast-detection auto-focus generally does a fairly good job in focussing the image.

Cons of Contrast-Detection Auto-Focus:

Reasonably slow. Contrast-detection auto-focus is generally quite slow: it normally takes around one second for the image to focus. During this time, it’s possible you might miss the image you want to capture (e.g. in a fast-moving scene).

It doesn’t always work in low-light conditions. As contrast-detection auto-focus relies on measuring the contrast in an image, it sometimes won’t work if there’s little contrast in the scene to begin with. See the article here for a few examples of when it won’t work properly.

You can’t track moving objects. If you’re taking a photo of something that’s moving, it’ll lose contrast as it goes out of focus. Unfortunately, contrast-detection auto-focus won’t tell you whether the object has moved forwards or backwards. Your phone will, therefore, need to start a new search to find the new focal point (this doesn’t look good when shooting a video).

Phase-Detection Autofocus: A Faster & More Advanced Alternative

Phase-detection auto-focus is a newer and more advanced method of focussing an image. The technique is more commonly seen on DSLRs rather than smartphones or compact cameras. Recently, the technology has appeared on high-end smartphones from Apple and Samsung. You’ll find it on the Galaxy S5, the Galaxy S6, the iPhone 6 and the iPhone 6 Plus. On the iPhone, the technology is known as ‘Focus Pixels’.

With phase-detection auto-focus, your camera analyses the light as it passes through the lens. It compares light from two apertures on opposite sides of the lens. If the image is properly focussed, the two light rays will give an overlapping intensity profile. If the image isn’t focussed, the system can determine exactly how much the focus needs to be adjusted. It’s then able to focus the image without the lengthy back-and-forth seen on contrast-detection.

According to Samsung, the Galaxy S5 can focus in an image in only 0.3 seconds using phase-detection auto-focus.

how phase detection autofocus works
Phase detection autofocus

With phase-detection auto-focus, it’s possible to see when the image is in focus. More importantly, when the image is out-of-focus, a comparison of the light intensity profiles will tell you how much the focus will need to be adjusted.

Pros of Phase-Detection Auto-Focus:

  1. It’s fast and accurate. It takes only around 0.3 seconds to focus an image with phase-detection auto-focus. This is approximately 3 times faster than contrast-detection. With faster auto-focus, it’s much quicker to get the images you want. In fast-moving scenes (e.g. in a sports game), there’s less chance of missing the picture you want to capture.

  2. You can do continuous auto-focus. With phase-detection auto-focus, it’s possible to do continuous auto-focus. A moving object can always be kept sharp and in focus (especially important when you’re recording a video).

Cons of Phase-Detection Auto-Focus:

  1. It still works poorly in low-light conditions. Like contrast-detection, phase-detection auto-focus also works on analysing the light that comes into the lens. In low-light conditions, it can sometimes be difficult to analyse the image.
  2. It’s only available on a number of high-end smartphones. At present, phase-detection auto-focus is only available on high-end devices from Apple and Samsung.

Laser Autofocus: Active Autofocus

Whilst Apple and Samsung have put their efforts behind phase-detection auto-focus, LG has taken a totally different approach with laser auto-focus on the LG G3 and the LG G4.

With contrast-detection and phase-detection auto-focus, we analyse the light that comes in to the camera. Collectively, the two methods are known as passive auto-focus. In contrast, laser auto-focus is a very different system. It’s known as active auto-focus as it doesn’t rely on incoming light. Instead, the phone will emit its own beam of infrared light towards the object. It calculates the time for the light to be reflected and is then able to calculate the distance to the object:

Distance travelled by laser beam = Speed of Light * Time to receive reflection Distance to object = Distance travelled by laser beam / 2

It essentially uses the principle of RADAR. After the distance to the object has been determined, the lens is moved to the relevant position. According to LG, the whole process only takes 0.276 seconds. This makes it a much quicker method than contrast-detection auto-focus. It’s also marginally faster than doing phase-detection.

how laser autofocus works
Laser autofocus

The LG G3 and LG G4 will emit a beam of infrared light to measure the distance to an object. It uses the information to quickly focus the camera.

Pros of Laser Auto-Focus:

It’s super-fast. According to LG, it only takes 0.276 seconds to focus an image with laser auto-focus.

It works in low-light conditions. Laser auto-focus doesn’t rely on light from the object. Instead, it emits its own beam of light from which the distance to the object can then be determined. For this reason, the method will work in any lighting condition (it’s particularly beneficial for low-light photography).

Cons of Laser Auto-Focus:

It’s only effective up to a certain distance. If the object is a long way away, it’s unlikely you’ll receive any reflections. According to LG, laser auto-focus works best when the object is within 0.6m. The total range of effectiveness is around 5m (beyond this, the phone will fall back to contrast-detection).

It can sometimes be confused by reflections. For instance, if you try to take photos through a window, the laser beam could be reflected by the window. This will give an incorrect measurement of distance (the image will be focussed on the window rather than the object).

It’s expensive and requires additional hardware. Laser auto-focus is currently available only on high-end smartphones from LG.

Final Thoughts…

When taking photos on your smartphone, it’s important the image is in focus. This will allow you to capture the full amount of detail.

At present, most smartphones use a technique called contrast-detection to focus their images. While it typically gives fairly good results, it’s relatively slow and doesn’t work in low-light conditions. It’s also unsuitable when recording a video: the phone isn’t able to track a moving object.

In the past year, a number of alternative techniques have appeared on high-end smartphones for better auto-focus. Apple and Samsung are using phase-detection auto-focus whereas LG is using laser auto-focus. Both methods are much faster than contrast-detection though they also both have their own downsides.

For the best smartphones with a 30-day money back guarantee, check out the giffgaff store.


Written by abdulf

abdulf
Abdul is a huge tech fanatic. Check out his personal finance website at olivermoney.com.