如何在iOS上生成带有semanticSegmentationSkyMatteImage信息的图像?

问题描述 投票:0回答:1

我正在尝试在 iPhone 拍摄的照片上创建天空遮罩。 我在文档中看到 CoreImage 支持天空的语义分割以及其他类型的人(皮肤、头发等...)

目前,我还没有找到使用它的正确工作流程。

首先,我观看了https://developer.apple.com/videos/play/wwdc2019/225/

我明白图像必须通过这种代码的分割来捕获:

photoSettings.enabledSemanticSegmentationMatteTypes = self.photoOutput.availableSemanticSegmentationMatteTypes
photoSettings.embedsSemanticSegmentationMattesInPhoto = true

我在 iPhone 上捕获图像,将其保存为 HEIC 格式,然后,我尝试像这样加载遮罩:

let skyMatte = CIImage(contentsOf: imageURL, options: [.auxiliarySemanticSegmentationSkyMatte: true])

不幸的是,

self.photoOutput.availableSemanticSegmentationMatteTypes
总是给我一个仅针对个人的类型列表,而不是天空类型。

无论如何,AVSemanticSegmentationMatte.MatteType 只是 [头发、皮肤、牙齿、眼镜]...没有天空!!!

那么,我应该如何使用semanticSegmentationSkyMatteImage?!? 有什么简单的解决方法吗?

ios swift core-image semantic-segmentation
1个回答
0
投票

所以不幸的是,答案是使用私有库。

© www.soinside.com 2019 - 2024. All rights reserved.