swift - ARKit 人物遮挡 (.personSegmentationWithDepth) 冻结相机 (ARSceneView)
问题描述
当我在 ARKit 中切换到人物遮挡 (.personSegmentationWithDepth) 时,ARSCNView 有时会冻结。在 iOS 14.1 之前,下面的这段代码对我来说效果很好。或者。现在,切换到 .personSegmentationWithDepth 时相机不会冻结只是运气
func setupScene() {
sceneView.delegate = self
sceneView.session.delegate = self
sceneView.autoenablesDefaultLighting = true
sceneView.scene = scene
}
func initSceneSession() {
let configuration = ARWorldTrackingConfiguration()
configuration.planeDetection = .horizontal
sceneView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
}
func switchPeopleOcc(on: Bool){
guard let config = sceneView.session.configuration as? ARWorldTrackingConfiguration,
ARWorldTrackingConfiguration.supportsFrameSemantics(.personSegmentationWithDepth) else { return
}
switch on {
case true:
config.frameSemantics.insert(.personSegmentationWithDepth)
case false:
config.frameSemantics.remove(.personSegmentationWithDepth)
}
sceneView.session.run(config)
}
解决方案
推荐阅读
- flutter - 如何在 Flutter 中添加 Rive 动画
- python - 在Python中将邻接矩阵存储为图形对象
- split - 如何在 C 中修复此分段错误?
- postgresql - SQL 结果有大小限制吗?
- laravel - 在 NGINX Google Compute Engine 中从 Http 重定向到 https 问题
- lodash - 是否有用于从键名列表和评估器中生成对象的 lodash 快捷方式?
- python - 如何显示喜欢计数
- excel - 我可以使用 hlookup 或类似的东西来继续寻找特定的文本吗?
- sql - 两个实体之间可以发生多重关系吗?
- javascript - 如何从颜色选择器中获取 RGB 值并显示它们?