try! Swift 2019 demo app that converts Depth-less 2D images into Portrait mode.
try! Swift 2019 demo app that converts Depth-less 2D images into Portrait mode.
opencv2.framework
from here v3.4.x iOS pack, then put it into this folder.Portrait.xcworkspace
with Xcode 10.x and build itIn iOS’s Portrait mode, you can take beautiful photos that keep your subject sharp while blurring the background.
This so-called bokeh effect can be done by using Depth.
In contrast, this app attempts to make Depth-less 2D images into Portrait mode by following steps.
This app uses “GrabCut” to perform segmentation of the subject and the background.
As it’s not beautiful if the subject color leaks into the background, this app tries to delete the subject from the background by using “Inpainting”.
“Depth-of-Field” is the range where the photo is in focus.
I implemented an adjusting function to blur an area.
Result✨
before ← → after
Please give it a try !
Xcode 10.x+
iOS 12.0+
Special Thanks ✨