Giter Site home page Giter Site logo

3dobjectscanninganddetection's People

Contributors

brianadvent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

3dobjectscanninganddetection's Issues

How adjust project to track multiple objects?

How can I adjust this project to start tracking more than one object?
`
class ViewController: UIViewController, ARSCNViewDelegate {

@IBOutlet var sceneView: ARSCNView!
@IBOutlet var sceneView2: ARSCNView!

override func viewDidLoad() {
    super.viewDidLoad()
    
    // Set the view's delegate
    sceneView.delegate = self

    
    // Show statistics such as fps and timing information
    sceneView.showsStatistics = false
    
    // Create a new scene
    let scene = SCNScene(named: "art.scnassets/GameScene.scn")!

    
    // Set the scene to the view
    sceneView.scene = scene
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    
    // Create a session configuration
    let configuration = ARWorldTrackingConfiguration()
    let configuration2 = ARWorldTrackingConfiguration()

    
    // Object Detection
    configuration.detectionObjects = ARReferenceObject.referenceObjects(inGroupNamed: "CentroObjects", bundle: Bundle.main)!
    
    // Object Detection
    configuration2.detectionObjects = ARReferenceObject.referenceObjects(inGroupNamed: "SofaObjects", bundle: Bundle.main)!

    // Run the view's session
    sceneView.session.run(configuration)
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    
    // Pause the view's session
    sceneView.session.pause()
}

// MARK: - ARSCNViewDelegate

func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? {
    
    let node = SCNNode()
    let node2 = SCNNode()

    
    if let objectAnchor = anchor as? ARObjectAnchor {
        
        let plane = SCNPlane(width: CGFloat(objectAnchor.referenceObject.extent.x * 0.6), height: CGFloat(objectAnchor.referenceObject.extent.y * 0.5))
        
        plane.cornerRadius = plane.width / 8
        
        let spriteKitScene = SKScene(fileNamed: "ProductInfo_2")
        
        plane.firstMaterial?.diffuse.contents = spriteKitScene
        plane.firstMaterial?.isDoubleSided = true
        plane.firstMaterial?.diffuse.contentsTransform = SCNMatrix4Translate(SCNMatrix4MakeScale(1, -1, 1), 0, 1, 0)
        
        let planeNode = SCNNode(geometry: plane)
        planeNode.position = SCNVector3Make(objectAnchor.referenceObject.center.x, objectAnchor.referenceObject.center.y + 0.70, objectAnchor.referenceObject.center.z)
        
        node.addChildNode(planeNode)
        
    }
    
    if let objectAnchor2 = anchor as? ARObjectAnchor {

        let plane2 = SCNPlane(width: CGFloat(objectAnchor2.referenceObject.extent.x * 0.6), height: CGFloat(objectAnchor2.referenceObject.extent.y * 0.5))

        plane2.cornerRadius = plane2.width / 8

        let spriteKitScene2 = SKScene(fileNamed: "sofacama")

        plane2.firstMaterial?.diffuse.contents = spriteKitScene2
        plane2.firstMaterial?.isDoubleSided = true
        plane2.firstMaterial?.diffuse.contentsTransform = SCNMatrix4Translate(SCNMatrix4MakeScale(1, -1, 1), 0, 1, 0)

        let planeNode2 = SCNNode(geometry: plane2)
        planeNode2.position = SCNVector3Make(objectAnchor2.referenceObject.center.x, objectAnchor2.referenceObject.center.y + 0.70, objectAnchor2.referenceObject.center.z)

        node.addChildNode(<#T##child: SCNNode##SCNNode#>)
    }
    
    
    return node
}


func session(_ session: ARSession, didFailWithError error: Error) {
    // Present an error message to the user
    
}

func sessionWasInterrupted(_ session: ARSession) {
    // Inform the user that the session has been interrupted, for example, by presenting an overlay
    
}

func sessionInterruptionEnded(_ session: ARSession) {
    // Reset tracking and/or remove existing anchors if consistent tracking is required
    
}

}
`
I've tried to add multiple anchors but when I add it to the node it only loads the last one.

I get this error with beta 3 of IOS 12

2018-07-04 11:37:24.970087+0200 FlowerShop[278:13584] [framework] -[CUINamedRecognitionGroup initWithName:contentsFromCatalog:usingRenditionKey:fromTheme:] couldn't find image named 'MyPot' skipping
2018-07-04 11:37:25.329133+0200 FlowerShop[278:13658] [Technique] ARWorldTrackingTechnique(0x108009270) error resetting object detection: ObjectDetectionCallbackNotSet
2018-07-04 11:37:25.400514+0200 FlowerShop[278:13702] [Technique] Failed to add 3D objects to VIO database
2018-07-04 11:37:25.401412+0200 FlowerShop[278:13702] [Session] Session (0x106513520): did fail with error: Error Domain=com.apple.arkit.error Code=301 UserInfo={NSLocalizedDescription=, NSLocalizedFailureReason=}

Issue using a different Scan

2018-09-25 16:59:33.442397+0300 FlowerShop[1573:295387] Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.