How to repair your phone’s shitty portrait mode


Ever considering the fact that Apple introduced their depth map generated fake background blur filter recognized as Portrait mode, virtually all other telephone tends to make have also added that function.  In all situations it is terrible at generating your images appear great mainly because the filters never ever get the edge facts suitable.  They’re often either more than masked or below masked and it often appears like a it was created by a higher college Photoshop student who only took the class mainly because they believed it was an uncomplicated A and didn’t seriously care about good quality.  I had often wished that I could get that actual depth map out of these telephone cameras and repair it up in Photoshop in order to make an basically great image.

Here’s what the image from the telephone appears like.

In this tutorial, we’re going to appear at a approach for fixing the depth map generated by a Nokia 9 Pureview telephone making use of Adobe Photoshop. You can likely translate these strategies to other telephone cameras and photo editing applications like GIMP, Krita, Affinity Photo, and so on.

Extract the depth map

The logical approach of saving the depth map with the photo would have been to consist of it either as an Alpha channel or as a separate file. In the early days of video compositing with transparency masks, that is what we often did.  That is not how any of these cameras operate even though.  Alternatively we have to use a unique tool to extract the depth map.

There’s a totally free internet-primarily based tool at which will do it. Now, the depth map details is ordinarily saved inside the JPG on quite a few Android devices… not the DNG file like one particular would hope.

We’re going to use a photo from the Nokia 9 Pureview considering the fact that its five cameras must give us a quite great beginning point for the depth map.

Very first, upload your photo to the Omnivirt 3D photo creator tool.

Then download the ZIP file and extract it to a folder.

The file named “image_depth.jpg” is the one particular that consists of the extracted depth map. It will appear one thing like the above.  The lighter shades of grey indicate pixels that are closer to the camera whilst the darker shades specify pixel regions that are additional away. And as you can see… this depth map is an awful mess.

Bring every thing into Photoshop

Now, alternatively of applying that depth map to the telephone-processed JPG, I’m going to open the RAW DNG file in Photoshop.  Yes, the Nokia 9 Pureview RAW files are also currently hardware-processed to merge the five camera images into one particular, but it is nevertheless superior than making use of the JPG and we’ll be in a position to make a a lot extra versatile non-destructive layered image file. The Nokia 9 Pureview is in a position to save each a processed JPG along with the RAW DNG file, so that function assists a lot right here as effectively. Do not overlook to hold down “Shift” in the Adobe Camera Raw dialog in order to open the DNG file as a Sensible Object.

Subsequent I’m going to generate a new Alpha channel in that DNG file and Copy/Paste the image_depth.jpg into that Alpha channel. Then we must likely do File &gt Save As &gt and make a new PSD file to preserve every thing.

Subsequent I’m going to make a copy of the image layer by dragging it to the new layer icon in the Layers palette, then I’ll load that Alpha channel as a choice by Ctrl + clicking on it. Then choose the image layer copy and decide on Layer &gt Layer Mask &gt Reveal choice to generate a layer mask.  This leading layer will be our in-concentrate layer.

Subsequent, Alt/Opt click on the layer mask that we just designed in the Layers palette. This will let you see the greyscale levels of the layer mask.  The white regions are the points closest to the camera whilst the black regions are the furthest away.  I’m going to use this to make my topic stay sharp and unmodified whilst letting the far away regions be blurred by a filter.  Now, you will notice that my model’s face is 87% black in this depth map.  That is way as well a lot!

So I’m going to hit Ctrl + M and use the white eye dropper to click on her forehead in order to make the model’s mask location white and hence opaque. You can see this causes a lot of banding involving the depth levels mainly because our depth map does not have a lot variety or resolution.

Now I’m going to apply a Gaussian Blur filter to the bottom image layer and we’ve got nearly the very same point that the phone’s background blur filter would have accomplished.  It is a terrible mess!!

Now you can handle it

All of that operate to get one thing that appears just as negative as what the camera telephone did automatically could appear like a wast of time, but NOW we have that Photoshop file set up so that we can basically handle points with a lot extra flexibility.  So subsequent you will want to get your painting tools prepared mainly because we’re going to repair that depth map manually.

This is exactly where you require a bit of talent and you will likely require to transform your approach based on what sort of image you are functioning with.  Essentially, you require to use painting tools with varying levels of black, white, and grey to edit the layer mask till it appears suitable. There are tons of diverse strategies you could use right here as effectively. You can use a stress sensitive pen to just paint away the ugly regions, or you can use some of the colour channels from the original image to generate selections or sub-masks and use these to paint away the ugly areas… the possibilities are endless. It is challenging to inform you precisely what to do right here considering the fact that there are so quite a few possibilities.

For this image, I mostly utilised the stress-sensitive pen approach.  Use the [ ] bracket keys to transform the brush’s diameter as you go.  Use the X crucial to switch involving black and white paint colors as you modify the mask.  Use the quantity keys to speedily transform the flow of an airbrush or opacity of a paintbrush.

How a lot work you place into fixing the depth map mask once again depends on you and what sort of image you are making use of.  Above is what I ended up with.  It is not great, but it must do fine. Note that I added a gradient blend on the floor location so that the ground level closest to the model would evenly remain sharp. A lot of depth maps generated in telephone cameras do not get that suitable.

Employing the great depth map

The above approach for making use of a sharp masked copy of the image on leading of a blurred copy of the image was mostly meant for editing the mask in order to get a decent depth map.  That approach is not rather suitable for the final image mainly because the transparency masking on leading blends with the blurred image on the bottom and blurred edges bleed out about the sides.  Actually, we want to use the new depth map to apply a Lens blur progressively in diverse regions.

Copy the grey-scale final layer mask into a new Alpha channel.  You can do this by loading it as a choice and then generating a new Alpha channel from the choice.  Mine is named “Alpha 4”.

What I did subsequent was generate a copy of the original DNG Sensible object layer, then suitable click it and decide on “Rasterize”.  This removes the non-destructive properties for that layer and this is vital for the “Lens blur” filter to operate.  Subsequent, I chose Filter &gt Blur &gt Lens blur which brings up the above filter dialog.  The significant element right here is that you decide on your final edited depth map alpha channel in the Depth Map &gt “Source” drop down menu.  It could be that the filter applies to the topic alternatively of the background if you utilised whites to reveal the topic in your alpha channel.  If this is the case, click the “invert” checkbox in the Lens Blur filter to apply the filter to the opposite regions.  Adjust the other sliders, specifically the “radius” one particular, as you see match and click OK to apply.

That is it!  Now you have a a lot superior fake background blur filter!

Here’s what the final image appears like.


Guest look by Dasha Mudrova.

Talk about This Post


Latest posts