Espresso is a package for getting a depth data image from a portrait image taken by iPhone.
import AVFoundation
import Espresso
/// URL of a portrait image
let url = URL()
// get a depth data image as UIImage from URL
if let depthData = AVDepthData.fromURL(url) {
let espresso = Espresso(depthData)
let depthImage = espresso.uiImage(orientation: .right, depthType: .depth)
}
// get a depth data image as NSImage from URL
if let depthData = AVDepthData.fromURL(url) {
let espresso = Espresso(depthData)
let depthImage = espresso.nsImage(depthType: .depth)
}
See also DepthBrewer for examples using Espresso
This package is compatible with iOS 12 or higher and macOS 10.15 or heigher.
Add this Swift package in Xcode using its GitHub repository URL. (File > Add Packages...)
Espresso is available under the MIT licence. See the LICENSE file for more info.