2

Is there any way to improve ARKit Plane detection and Reduce the time consumed to detect it? Here we are detecting a horizontal plane thing is if we keep the camera steady it takes time to detect and it does not work on floors.

For table and other similar surfaces, it's taking around 5 to 6 sec. but for floor its more than 20 or half a minute and if we don't move the camera it does not work at all.

Here is my code:-

   override func viewDidLoad() {
    super.viewDidLoad()
    SVProgressHUD.show(withStatus: "Detecting Plane and Getting ready")
    sceneView.delegate = self
    sceneView.session.delegate = self
    sceneView.showsStatistics = false
    let configuration = ARWorldTrackingConfiguration()
    configuration.planeDetection = .horizontal
    configuration.isLightEstimationEnabled = true

    sceneView.session.run(configuration)
    sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
}
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {

    if currentAnchor == nil {
        currentAnchor = anchor

        let light = SCNLight()
        light.type = .directional
        light.color = UIColor(white: 1.0, alpha: 1.0)
        light.shadowColor = UIColor(white: 0.0, alpha: 0.8).cgColor
        let lightNode = SCNNode()
        lightNode.eulerAngles = SCNVector3Make(-.pi / 3, .pi / 4, 0)
        lightNode.light = light
        sceneView.scene.rootNode.addChildNode(lightNode)

        let ambientLight = SCNLight()
        ambientLight.type = .ambient
        ambientLight.color = UIColor(white: 0.8, alpha: 1.0)
        let ambientNode = SCNNode()
        ambientNode.light = ambientLight
        sceneView.scene.rootNode.addChildNode(ambientNode)
    }
    }
}

1 Answers1

0

I guess the floor is smooth and not textured enough. Surface detection can fail or take too long for a variety of reasons—insufficient light, an overly reflective surface, a surface without enough detail, or too much camera motion.

Try moving around, turning on more lights, and making sure the surface is textured enough.

Smooth surfaces make it difficult for ARKit to detect them. The more textured a surface is, the faster ARKit will detect it.

M Reza
  • 18,350
  • 14
  • 66
  • 71