Ultra-wide-angle lenses are becoming increasingly popular on smartphones in both rear and front cameras. Especially the latter are frequently used for portraiture in the shape of selfie images of both single subjects and groups.

Unfortunately when capturing people pictures with a wide-angle lens a problem becomes apparent: faces that are located close to the edges of the frame are distorted, showing signs of unnatural stretching, squishing, and/or skewing, an effect that is also known as anamorphosis.

Fortunately Google has found an efficient way of reducing the effect drastically in its Pixel 3 series phones. The team behind the algorithm, a group of Google and MIT researchers led by YiChang Shih, has now published a paper titled “Distortion-Free Wide-Angle Portraits on Camera Phones,” that describes an algorithm that is capable of correcting the effect, making for more natural selfies and wide-angle portraits.

Previous solutions were capable of correcting distortion on faces but in turn introduced other artifacts to the background and other elements of the image. The new method works around this by creating a content-aware warping mesh and applying corrections only to the part of the frame where faces are detected and maintaining smooth transitions between faces and the rest of the image.

The researchers say good results were achieved on photos with a wide field-of-view ranging from 70° to 120° and the algorithm is fast enough to work “at an interactive rate”. More information is available on the project website.