ARKit 3.0 – 利用动作捕捉实现人物遮挡

3
我试图在同一个应用程序中加载人物遮挡(people occlusion)和运动捕捉(motion capture)。
由于ARBodyTrackingConfiguration不支持personSegmentationWithDepth,我创建了2个ARViews,并为每个视图提供不同的配置(ARWorldTrackingConfiguration和ARBodyTrackingConfiguration)。
问题是某些情况下只有一个委托回调被触发,没有深度数据可用。
我在这里做错了什么?
同时拥有多个ARSession是否可以?

你需要选择其中一个。使用人物分割的ARWorldTrackingConfiguration将在ARFrame上提供一个ARBody2D,它将为您提供比ARBodyTrackingConfiguration更少但同类信息。 - beyowulf
1个回答

1
在 ARKit 4.0 中,这两个功能可以同时运行。但是它们都需要消耗大量的 CPU 资源。
override func viewDidLoad() {
    super.viewDidLoad()
    
    guard ARBodyTrackingConfiguration.isSupported
    else { fatalError("MoCap is supported on devices with A12 and higher") }
    
    guard ARBodyTrackingConfiguration.supportsFrameSemantics(
                                               .personSegmentationWithDepth)
    else { fatalError("People occlusion is not supported on this device.") }
        
    let config = ARBodyTrackingConfiguration()
    config.frameSemantics = .personSegmentationWithDepth
    config.automaticSkeletonScaleEstimationEnabled = true
    arView.session.run(config, options: [])
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接