我使用 ARKit 1.5 和此功能来突出显示垂直表面,但效果并不理想。
func createPlaneNode(planeAnchor: ARPlaneAnchor) -> SCNNode {
let scenePlaneGeometry = ARSCNPlaneGeometry(device: metalDevice!)
scenePlaneGeometry?.update(from: planeAnchor.geometry)
let planeNode = SCNNode(geometry: scenePlaneGeometry)
planeNode.name = "\(currPlaneId)"
planeNode.opacity = 0.25
if planeAnchor.alignment == .vertical {
planeNode.geometry?.firstMaterial?.diffuse.contents = UIColor.red
}
currPlaneId += 1
return planeNode
}
它总是在垂直对象上找到一些 FeaturePoints,但是很少使用我创建的 planeNode 来突出显示表面。
我希望能够发现并突出显示诸如支柱甚至是男人之类的东西。您将如何处理? 具有 FeaturePoints 的对象的图像 在最佳情况下具有结果的图像
1 回答
在 ARKit 1.5 和 ARKit 2.0 中,有**.planeDetection**实例属性允许您启用
.horizontal
,.vertical
或同时启用.horizontal and .vertical
检测。ViewController 的代码:
如果要成功检测和跟踪环境中的垂直对象,则需要良好的照明条件和丰富的 non-repetitive 纹理。看下面的图片:
希望这可以帮助。