【问题标题】:ARKit 1.5 – Vertical objects detectionARKit 1.5 – 垂直物体检测
【发布时间】:2020-03-27 04:40:58
【问题描述】:

我使用 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 突出显示了表面。

我希望能够检测并突出显示诸如柱子甚至人之类的东西。你会如何处理这个问题? Image of object with featurePoints Image with the result in best case scenario

【问题讨论】:

    标签: swift augmented-reality arkit


    【解决方案1】:

    在 ARKit 1.5 和 ARKit 2.0 中,有 .planeDetection 实例属性允许您启用 .horizontal.vertical 或同时启用 .horizontal and .vertical 检测。

    var planeDetection: ARWorldTrackingConfiguration.PlaneDetection { get set }
    

    ViewController 的代码:

    let configuration = ARWorldTrackingConfiguration()
    configuration.planeDetection = .vertical
    //configuration.planeDetection = [.vertical, .horizontal]
    sceneView.session.run(configuration)
    

    如果您想成功检测和跟踪环境中的垂直物体,您需要良好的照明条件和丰富的非重复纹理。看下图:

    【讨论】:

      猜你喜欢
      • 2017-11-09
      • 2019-04-30
      • 1970-01-01
      • 2018-02-15
      • 2019-08-17
      • 1970-01-01
      • 2014-07-06
      • 2020-11-07
      相关资源
      最近更新 更多