我已经使用ARKit创建了一个3D对象识别应用程序,它可以正常运行....但是仅适用于更复杂的形状。当我使用Apple的演示代码创建USDZ文件时,演示应用可以识别不太复杂的形状,但是我无法让我的应用识别相同的形状。我拥有的AR配置代码与_Renderer didAdd相同。谁能帮助我提出有关如何提高3D对象检测灵敏度的想法,以便它能够识别更简单的形状-例如2Ltr可口可乐瓶?预先感谢您的任何想法。
func initARSession() {
guard ARWorldTrackingConfiguration.isSupported else {
statusLabel.text = "ARConfig: AR World Tracking Not Supported"
return
}
let config = createARConfiguration()
sceneView.session.run(config)
}
func createARConfiguration() -> ARConfiguration {
let config = ARWorldTrackingConfiguration()
guard let referenceObjects = ARReferenceObject.referenceObjects(inGroupNamed: "ARObjects", bundle: nil) else {
fatalError("Missing expected asset catalog Object resources.")
}
config.detectionObjects = referenceObjects
config.planeDetection = .horizontal
config.worldAlignment = .gravityAndHeading
config.isLightEstimationEnabled = true
}
return config
}
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
guard let objectAnchor = anchor as? ARObjectAnchor else {return}
let foundObjectName = objectAnchor.referenceObject.name
print("foundObject: \(String(describing: foundObjectName!))")
}