Hot topics

Beautiful blur for smartphone portraits: How bokeh effect works

iphone x pixel 2 bokeh3
© nextpit

For decades, the only way to achieve atmospheric portraits with a beautiful bokeh effect was with a large image sensor and lenses with large focal lengths. Over the past several years, smartphones have learned to create a background blur effect via software. In this article, we will explain what bokeh is, how smartphones emulate this effect and the different approaches that exist for this.

iphone x pixel 2 bokeh2
A blurry background directs the viewer’s attention to the depicted subject. This blurriness is called bokeh, after the Japanese word for blurriness. Bokeh mode is often called portrait mode as well, since it is especially suited for portrait photos.  / © NextPit

About focus and blurriness in cameras

I would first like to start by explaining the concept of focus and blurriness and, to that end, consider a lens as one individual lens for simplicity’s sake. The greater the diameter of this lens, the quicker the rays drift apart in the beam path of the following graphic. As a result, objects outside of focus are no longer depicted in a punctiform manner but rather as an increasingly bigger circle as the lens diameter increases. As soon as one of these circles becomes greater on the sensor than a single pixel, the picture section in question is no longer in focus.

bokeh schematic
For the sake of simplicity, we have assumed that the focal distance is unlimited and as such, the incoming rays of light are parallel. The bigger the lens, the lower the tolerance until the size of the pixel (3) is exceeded. With a small lens (2), the rays of light travel more parallel from a certain point than with a large lens (1). / © NextPit

Apart from the lens’ diameter, the lens’ focal length also plays a role. The greater the focal length, the more selective the focus. What you may know as e.g. 24 or 26 millimeters from the datasheet is not the true focal length of the lenses; the 35-mm equivalent focal length is what’s specified here. It describes the focal length that the lens on a camera with a 36 x 24-millimeter sensor would need to have in order to achieve the same image angle as the smartphone’s lens-sensor combination. The real focal lengths of a smartphone’s wide-angle lenses actually range from 4.0 to 4.5 millimeters. 

One thing is clear due to the mini-lens and the tiny focal lengths: The depth of field is always huge on smartphones, and it also doesn’t help that smartphones have a smaller circle of confusion than single-lens reflex cameras due to their tiny pixels. I have deliberately left out one influencing factor on the depth of field: the distance from the subject – the closer the distance, the more selective the depth of field. Most of you will have observed the effect on macro photos with a smartphone.

iphone x pixel 2 bokeh
The iPhone X and the Pixel 2 each use different approaches to create bokeh effects. / © NextPit

A lot of CPU horsepower instead of a large lens

However, one thing that smartphones have to offer is a lot of computing power and/or other physical means of reproducing the effects via image processing. Generally speaking, it always works by having the camera distinguish between the foreground and background and then specifically blur the background. While doing so, the clearer the subject and background are separated from each other, the more impressive the effect.

Some flaws inherent in this process include protruding hairs that are blurred together with the background. Even glass presents a constant problem for bokeh functions: In most cases, the eyeglass lenses of the portrayed person are included in the foreground, but the background visible through the glasses is not blurred, which would have occurred in a visual bokeh effect.

oneplus 5 botched bokeh
Eyeglass lenses or minute details often give bokeh modes an impossible task. / © NextPit

These smartphone experiments with depth of field are not entirely new. The HTC One (M8) and even various Nokia Windows Phone devices (R.I.P.) brought the bokeh effect to pictures. However, neither the picture quality nor the processing speed was good enough and as a result, it ultimately did not manage to catch on until the past two years. 

As is the case today as well, different approaches were used in the aforementioned HTC One (M8) and Nokia devices, both of which we can still find in a very similar form in today’s smartphones. We would like to touch upon the differences and their pros and cons in the paragraphs below. Apart from Sony, LG and HTC—excluding the One (M8)—all large manufacturers now offer devices with bokeh functionality. 

AndroidPIT LG V30 iPhone 8 plus Galaxy Note 8 One Plus 5T HTC U11 Google Pixel 2 Huawei Mate 10Pro 5630
Five of the seven smartphones shown here offer the bokeh effect. / © NextPit

Dual camera for bokeh effects

Like the HTC One (M8), which pioneered the dual camera, many smartphones today also use a dual camera to calculate a depth map of the scene being photographed. Similar to our brain and two eyes, the smartphone uses the offset of both lenses. The software uses soft focus on the parts of the image that are identified as the background.

Identical focal lengths

The dual cameras of Huawei, Honor, Nokia and Motorola use identical focal lengths for each of the two sensors, making bokeh functionality available for wide-angle photos. On the cheaper dual-camera models, such as the Honor 7X, the second camera has a mere resolution of 2 megapixels, so its only purpose is to create a depth map.

On the other hand, flagships have an additional purpose for the camera: For instance, on the Huawei Mate 10 Pro, the second sensor takes high-resolution black-and-white photos to supplement the rear camera’s RGB shots with additional brightness information. Its purpose is to improve image quality, particularly when using digital zoom. On the other hand, the second camera on the OnePlus 5T is intended to provide assistance when taking nighttime shots.

AndroidPIT huawei mate 10 pro vs oneplus 5t 5876
The OnePlus 5T and Huawei Mate 10 Pro each have two cameras with the same focal length, albeit with different sensors. / © NextPit

Different focal lengths

Other models, among them the Asus Zenfone 4, the iPhones or the OnePlus 5, use different focal lengths in both lenses. As a result, the bokeh function is not available in wide-angle mode, since the tele-module does not allow for a second view for creating the depth map for the entire image. However, it works the other way around: An image extract from the wide-angle camera helps create a depth map for a telephoto. 

This limitation may not be dire in practice. In any case, the tele-module’s longer focal lengths particularly deliver nicer results for portrait photos. One special case is the Galaxy Note 8: Its wide-angle sensor namely offers dual-pixel autofocus, which makes the bokeh effect possible without a second camera—at least in theory, but we’ll elaborate more on that in a bit.

AndroidPIT iPhone 8 Plus vs Samsung Galaxy Note 8 3396
The Samsung Galaxy Note 8 and the iPhone 8 Plus each have a dual camera with different focal lengths. / © NextPit

Exceptional cases

There are also sporadic experiments with more elaborate camera systems where a depth map is not calculated from the offset of both lenses. For instance, the iPhone X’s front camera projects an infrared dot pattern onto the surroundings, allowing it to not only detect the user’s face but also cleanly crop it out from the surroundings. Huawei is working on a very similar system. 

The Asus Zenfone AR and the Lenovo Phab 2 Pro, each of which have a time-of-flight camera integrated below the rear camera, take it a step further. In the process, they scan the room with an infrared laser, which once again provides increased range. This technology, promoted by Google under Project Tango, has not managed to gain a foothold so far. Elsewhere, we already made an extensive report on Time-of-flight cameras and Project Tango.

AndroidPIT lenovo phab 2 pro tof camera 4479
The time-of-flight camera in Phab2 Pro creates spectacular AR effects. However, this now works with conventional smartphone cameras as well when paired with additional sensors. / © NextPit

Bokeh effects with just one lens

You are certainly familiar with the effect: Close one eye and your depth perception only works to a limited degree. So, how do smartphones with only one lens manage to distinguish between the foreground and background? 

There used to be an app called Refocus for the aforementioned Windows Phones. Here, the smartphones simply took photos with different focus points and, with the tap of a finger, the user could choose which areas to focus on. Although it worked very well, it was very slow and thus, only practical to a limited extent. However, hardware and software are more advanced nowadays, which is why it works, even without any focus bracketing.

AndroidPIT Google Pixel 2 4574
Thank goodness for dual-pixel autofocus: The Google Pixel 2 only needs one image sensor for bokeh effects. / © NextPit

The Google Pixel 2 offers the bokeh effect with one single lens. One feature of the IMX362 image sensor is helpful here, namely the dual-pixel autofocus. It divides every single pixel on the sensor into two halves and, like on dual cameras, this process makes it possible to generate two slightly shifted images. However, the technological implementation is more complex than with the two individual sensors, since the offset is not in the centimeter range, but rather equal to half of the lens diameter. The actual pixel generation process here combines a complete set of photos from the depth map and furthermore uses AI-supported image analysis.

For instance, on its Galaxy S8 and S8+, Samsung also uses an image sensor with dual-pixel autofocus (the Sony IMX333), but has so far foregone true bokeh functionality. Selective focus only works for macro shots and without any input from the user. However, the upcoming Oreo update is slated to give the Samsung Duo a true bokeh mode. Other smartphones equipped with dual-pixel autofocus, such as the HTC U11 or the Moto G5 Plus, currently do not have any bokeh functionality, although a software update can also provide them with it.

What do you guys think?

In conclusion, there are many different ways to take atmospheric background blurs, even with small image sensors and the mini-lenses found in smartphone cameras. Which approach would you like for your next smartphone? Let’s discuss the pros and cons in the comments below!

 The best smartphones under $400

  Editorial tip Price tip 3rd place 4th place 5th place
Image Google Pixel 6a Product Image Apple iPhone SE (2022) Product Image Samsung Galaxy A53 Product Image OnePlus Nord N20 Product Image Motorola Moto G Stylus 5G (2023) Product Image
Review: Google Pixel 6a
Review: Apple iPhone SE (2022)
Review: Samsung Galaxy A53
Not yet tested
Not yet tested
Price (MSRP)
  • $449.00
  • $429.00
  • $449.99
  • $299.00
  • $399.00
Go to comment (3)
Stefan Möllenhoff

Stefan Möllenhoff
Head of Content Production

I have been writing about technology since 2004 with a strong passion for smartphones, photography, and IoT, especially in the world of smart homes and AI ever since they debuted. I'm also an avid cook and bake pizza at least three times a week using my Ooni Koda 16. In order to compensate for all the consumed calories, I indulge in sporting activities on a daily basis while strapping on at least two fitness trackers. I am strongly convinced that you can DIY a lot of things if you put your mind to it - including a photovoltaic system and power station.

View all articles
Liked this article? Share now!
Recommended articles
Latest articles
Push notification Next article
Write new comment:
All changes will be saved. No drafts are saved when editing
Write new comment:
All changes will be saved. No drafts are saved when editing

  • Rupert S 1
    Rupert S Aug 9, 2021 Link to comment

    "a large image sensor and lenses with large focal lengths" - you're forgetting aperture. Nice article though.

  • AlexMongoose 2
    AlexMongoose Dec 24, 2017 Link to comment

    Very interesting topic.

  • 9
    Richard Fernandez Dec 23, 2017 Link to comment

    bokka shmokka

Write new comment:
All changes will be saved. No drafts are saved when editing