avdepthdata

How to build AVDepthData manually

烂漫一生 提交于 2019-12-12 07:27:08
问题 I want to build my own depth map and save image like portrait photo with depth info. So first of all I need generate AVDepthData. After dig how it builded, I try to reproduce it: func buildDepth() { // ... let info: [AnyHashable: Any] = [kCGImagePropertyPixelFormat: kCVPixelFormatType_DisparityFloat32, kCGImagePropertyWidth: width, kCGImagePropertyHeight: height, kCGImagePropertyBytesPerRow: bytesPerRow] let metadata = generateMetadata(photo: photo) let dic: [AnyHashable: Any] =