•introducing arkit augmented reality for ios - apple inc. · augmented reality computer vision...

187
#WWDC17 © 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Mike Buerli, ARKit Engineer Stefan Misslinger, ARKit Engineer Introducing ARKit Augmented Reality for iOS Session 602 Graphics and Games

Upload: trinhdiep

Post on 18-Mar-2019

251 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

#WWDC17

© 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

Mike Buerli, ARKit Engineer Stefan Misslinger, ARKit Engineer

•Introducing ARKit •Augmented Reality for iOS • Session 602

Graphics and Games

Page 2: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Augmented Reality

Page 3: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 4: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 5: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 6: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 7: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 8: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 9: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Augmented Reality

Computer Vision

Surface Estimation

Scene Understanding

Feature Detection

Bundle Adjustment

Sensor Fusion

Camera Calibration

Visual-inertial Navigation

SLAM

Feature Matching

Light Estimation

Camera Intrinsics

Optimal Correction Nonlinear Optimization

Triangulation

Page 10: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

NEW

Page 11: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARKit

Mobile AR platform

High-level API

iOS (A9 and up)

NEW

Page 12: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World tracking

Visual inertial odometry

No external setup

Tracking

Page 13: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Plane detection

Hit-testing

Light estimation

Scene Understanding

Page 14: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Easy integration

AR views

Custom rendering

Rendering

Page 15: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 16: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

•Getting Started

Page 17: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Rendering

Application

SceneKit SpriteKit Metal

Processing

ARKit

Page 18: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

AVFoundation CoreMotion

Capturing

ARKit

Page 19: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

Page 20: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration ARSession

Page 21: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

run(_ configuration)

ARSession

Page 22: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

AVCaptureSession CMMotionManager

run(_ configuration)

ARSession

Page 23: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration ARFrameARFrameARFrame

AVCaptureSession CMMotionManager

run(_ configuration) currentFrame

ARSession

Page 24: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

Page 25: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

Configuration Classes

Page 26: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

Configuration Classes ARSessionConfiguration

ARWorldTrackingSessionConfiguration

Page 27: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

Configuration Classes

Enable/Disable Features

Page 28: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

Configuration Classes

Enable/Disable Features

Availability

Page 29: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSessionConfiguration

Configuration Classes

Enable/Disable Features

Availability

if ARWorldTrackingSessionConfiguration.isSupported { configuration = ARWorldTrackingSessionConfiguration() } else { configuration = ARSessionConfiguration() }

Page 30: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

Page 31: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

ARSession

Page 32: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

ARSession

// Run your sessionsession.run(configuration)

Page 33: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

ARSession

// Run your sessionsession.run(configuration)

// Pause your sessionsession.pause()

Page 34: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

ARSession

// Run your sessionsession.run(configuration)

// Pause your sessionsession.pause()

// Resume your sessionsession.run(session.configuration)

Page 35: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

ARSession

// Run your sessionsession.run(configuration)

// Pause your sessionsession.pause()

// Resume your sessionsession.run(session.configuration)

// Change your configurationsession.run(otherConfiguration)

Page 36: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

Reset tracking

ARSession

Page 37: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

Reset tracking

ARSession

// Reset tracking session.run(configuration, options: .resetTracking)

Page 38: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

Reset tracking

Session updates

ARSession

Page 39: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

Reset tracking

Session updates

ARSession

// Access the latest frame func session(_: ARSession, didUpdate: ARFrame)

Page 40: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Manage AR processing

Reset tracking

Session updates

ARSession

// Access the latest frame func session(_: ARSession, didUpdate: ARFrame)

// Handle session errors func session(_: ARSession, didFailWithError: Error)

Page 41: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

Manage AR processing

Reset tracking

Session updates

Current frame

Page 42: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARFrame

Page 43: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARFrame

Captured image

Page 44: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARFrame

Captured image

Tracking information

Page 45: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARFrame

Captured image

Tracking information

Scene information

Page 46: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARAnchor

Page 47: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARAnchor

Real-world position and orientation

Page 48: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARAnchor

Real-world position and orientation

ARSession add/remove

Page 49: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARAnchor

Real-world position and orientation

ARSession add/remove

ARFrame anchors

Page 50: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARAnchor

Real-world position and orientation

ARSession add/remove

ARFrame anchors

ARSessionDelegate add/update/remove

Page 51: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

•Tracking

Page 52: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 53: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 54: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Page 55: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Position and orientation

Page 56: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Position and orientation

Physical distances

1m

Page 57: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Position and orientation

Physical distances

Relative to starting position

1m

Page 58: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Position and orientation

Physical distances

Relative to starting position

3D-feature points

1m

Page 59: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Page 60: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

World Tracking

Page 61: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Create a session let mySession = ARSession()

// Set ourselves as the session delegate mySession.delegate = self

// Create a world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Run the session mySession.run(configuration)

Page 62: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Create a session let mySession = ARSession()

// Set ourselves as the session delegate mySession.delegate = self

// Create a world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Run the session mySession.run(configuration)

Page 63: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Create a session let mySession = ARSession()

// Set ourselves as the session delegate mySession.delegate = self

// Create a world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Run the session mySession.run(configuration)

Page 64: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Create a session let mySession = ARSession()

// Set ourselves as the session delegate mySession.delegate = self

// Create a world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Run the session mySession.run(configuration)

Page 65: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Create a session let mySession = ARSession()

// Set ourselves as the session delegate mySession.delegate = self

// Create a world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Run the session mySession.run(configuration)

Page 66: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

ARSession

Page 67: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

ARSession

AVCaptureSession

Page 68: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

ARSession

CMMotionManager

AVCaptureSession

Page 69: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

ARSession

CMMotionManager

AVCaptureSession

Page 70: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

ARSession

CMMotionManager

AVCaptureSession

Page 71: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSession

ARSession

CMMotionManager

AVCaptureSession

Page 72: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARCamera

+y

-y

-z

+z+x

-x

Page 73: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARCamera

Transform+y

-y

-z

+z+x

-x

Camera

Page 74: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARCamera

Transform

Tracking state

+y

-y

-z

+z+x

-x

Camera

Page 75: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARCamera

Transform

Tracking state

Camera intrinsics

+y

-y

-z

+z+x

-x

Camera

Page 76: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

•Demo •Creating Your First ARKit Application

Page 77: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Tracking Quality

Page 78: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Tracking Quality

Uninterrupted sensor data

Page 79: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Tracking Quality

Uninterrupted sensor data

Textured environments

Page 80: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Tracking Quality

Uninterrupted sensor data

Textured environments

Static scenes

Page 81: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Tracking State

NormalNot Available Limited Normal<Insufficient Features>

Page 82: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Tracking State

NormalNot Available Limited Normal<Insufficient Features>

func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) { if case .limited(let reason) = camera.trackingState { // Notify user of limited tracking state ... } }

Page 83: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Session Interruptions

Camera input unavailable

Tracking is stopped

Page 84: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Session Interruptions

Camera input unavailable

Tracking is stopped

func sessionWasInterrupted(_ session: ARSession) { showOverlay() } func sessionInterruptionEnded(_ session: ARSession) { hideOverlay() // Optionally restart experience ... }

Page 85: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Stefan Misslinger, ARKit Engineer

•Scene Understanding

Page 86: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Scene Understanding

Page 87: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Scene Understanding

Page 88: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Scene Understanding

Plane detection

Page 89: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Scene Understanding

Plane detection

Hit-testing

Page 90: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Scene Understanding

Plane detection

Hit-testing

Light estimation

Page 91: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Plane Detection

Page 92: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Plane Detection

Horizontal with respect to gravity

Page 93: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Plane Detection

Horizontal with respect to gravity

Runs over multiple frames

Page 94: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Plane Detection

Horizontal with respect to gravity

Runs over multiple frames

Aligned extent for surface

Page 95: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Plane Detection

Horizontal with respect to gravity

Runs over multiple frames

Aligned extent for surface

Plane merging

Page 96: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Enable plane detection on a session

// Create a new world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Enable plane detection configuration.planeDetection = .horizontal

// Change configuration on currently running session mySession.run(configuration)

Page 97: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Enable plane detection on a session

// Create a new world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Enable plane detection configuration.planeDetection = .horizontal

// Change configuration on currently running session mySession.run(configuration)

Page 98: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Enable plane detection on a session

// Create a new world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Enable plane detection configuration.planeDetection = .horizontal

// Change configuration on currently running session mySession.run(configuration)

Page 99: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Enable plane detection on a session

// Create a new world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Enable plane detection configuration.planeDetection = .horizontal

// Change configuration on currently running session mySession.run(configuration)

Page 100: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Enable plane detection on a session

// Create a new world tracking configuration let configuration = ARWorldTrackingSessionConfiguration()

// Enable plane detection configuration.planeDetection = .horizontal

// Change configuration on currently running session mySession.run(configuration)

Page 101: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Page 102: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Page 103: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

// Called when a new plane was detected func session(_ session: ARSession, didAdd anchors: [ARAnchor]) { addPlaneGeometry(forAnchors: anchors) }

Page 104: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

// Called when a new plane was detected func session(_ session: ARSession, didAdd anchors: [ARAnchor]) { addPlaneGeometry(forAnchors: anchors) }

Page 105: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

// Called when a new plane was detected func session(_ session: ARSession, didAdd anchors: [ARAnchor]) { addPlaneGeometry(forAnchors: anchors) }

Page 106: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

Page 107: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

// Called when a plane’s transform or extent is updated func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) { updatePlaneGeometry(forAnchors: anchors) }

Page 108: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

// Called when a plane’s transform or extent is updated func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) { updatePlaneGeometry(forAnchors: anchors) }

Page 109: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

Page 110: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

// Called when a plane was removed as a result of a merge func session(_ session: ARSession, didRemove anchors: [ARAnchor]) { removePlaneGeometry(forAnchors: anchors) }

Page 111: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARPlaneAnchor

Transform

Extent

Center

// Called when a plane was removed as a result of a merge func session(_ session: ARSession, didRemove anchors: [ARAnchor]) { removePlaneGeometry(forAnchors: anchors) }

Page 112: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Hit-Testing

Page 113: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Hit-Testing

Intersect ray with real world

Page 114: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Hit-Testing

Intersect ray with real world

Uses scene information

Page 115: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Hit-Testing

Intersect ray with real world

Uses scene information

Results sorted by distance

Page 116: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Hit-Testing

Intersect ray with real world

Uses scene information

Results sorted by distance

Hit-test types

Page 117: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Hit-Test Types

Page 118: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Existing plane using extent

Hit-Test Types

Page 119: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Existing plane using extent

Existing plane

Hit-Test Types

Page 120: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Existing plane using extent

Existing plane

Estimated plane

Hit-Test Types

Page 121: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Existing plane using extent

Existing plane

Estimated plane

Feature point

Hit-Test Types

Page 122: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Adding an ARAnchor based on hit-test let point = CGPoint(x: 0.5, y: 0.5) // Image center

// Perform hit-test on frame let results = frame.hitTest(point, types: [.existingPlane, .estimatedHorizontalPlane])

// Use the first result if let closestResult = results.first {

// Create an Anchor for it let anchor = ARAnchor(transform: closestResult.worldTransform)

// Add it to the session session.add(anchor: anchor)

}

Page 123: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Adding an ARAnchor based on hit-test let point = CGPoint(x: 0.5, y: 0.5) // Image center

// Perform hit-test on frame let results = frame.hitTest(point, types: [.existingPlane, .estimatedHorizontalPlane])

// Use the first result if let closestResult = results.first {

// Create an Anchor for it let anchor = ARAnchor(transform: closestResult.worldTransform)

// Add it to the session session.add(anchor: anchor)

}

Page 124: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Adding an ARAnchor based on hit-test let point = CGPoint(x: 0.5, y: 0.5) // Image center

// Perform hit-test on frame let results = frame.hitTest(point, types: [.existingPlane, .estimatedHorizontalPlane])

// Use the first result if let closestResult = results.first {

// Create an Anchor for it let anchor = ARAnchor(transform: closestResult.worldTransform)

// Add it to the session session.add(anchor: anchor)

}

Page 125: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Adding an ARAnchor based on hit-test let point = CGPoint(x: 0.5, y: 0.5) // Image center

// Perform hit-test on frame let results = frame.hitTest(point, types: [.existingPlane, .estimatedHorizontalPlane])

// Use the first result if let closestResult = results.first {

// Create an Anchor for it let anchor = ARAnchor(transform: closestResult.worldTransform)

// Add it to the session session.add(anchor: anchor)

}

Page 126: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Adding an ARAnchor based on hit-test let point = CGPoint(x: 0.5, y: 0.5) // Image center

// Perform hit-test on frame let results = frame.hitTest(point, types: [.existingPlane, .estimatedHorizontalPlane])

// Use the first result if let closestResult = results.first {

// Create an Anchor for it let anchor = ARAnchor(transform: closestResult.worldTransform)

// Add it to the session session.add(anchor: anchor)

}

Page 127: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

// Adding an ARAnchor based on hit-test let point = CGPoint(x: 0.5, y: 0.5) // Image center

// Perform hit-test on frame let results = frame.hitTest(point, types: [.existingPlane, .estimatedHorizontalPlane])

// Use the first result if let closestResult = results.first {

// Create an Anchor for it let anchor = ARAnchor(transform: closestResult.worldTransform)

// Add it to the session session.add(anchor: anchor)

}

Page 128: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 129: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 130: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 131: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor
Page 132: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Light Estimation

Page 133: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Light Estimation

Ambient intensity based on captured image

Page 134: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Light Estimation

Ambient intensity based on captured image

Defaults to 1000 lumen

Page 135: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Light Estimation

Ambient intensity based on captured image

Defaults to 1000 lumen

Enabled by default

Page 136: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Light Estimation

Ambient intensity based on captured image

Defaults to 1000 lumen

Enabled by default

configuration.isLightEstimationEnabled = true

Page 137: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Light Estimation

Ambient intensity based on captured image

Defaults to 1000 lumen

Enabled by default

configuration.isLightEstimationEnabled = true

// Get ambient intensity value let intensity = frame.lightEstimate?.ambientIntensity

Page 138: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

•Demo •Scene understanding in ARKit

Page 139: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

•Rendering

Page 140: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit SpriteKit Metal

Page 141: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNView

SCNView

ARSCNView

ARSession

Page 142: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNView

Draws captured imageSCNView

ARSCNView

ARSession

Page 143: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNView

Draws captured image

Updates a SCNCameraSCNView

ARSCNView

ARSession

Page 144: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNView

Draws captured image

Updates a SCNCamera

Updates scene lighting

SCNView

ARSCNView

ARSession

Page 145: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNView

Draws captured image

Updates a SCNCamera

Updates scene lighting

Maps SCNNodes to ARAnchors

SCNView

ARSCNView

ARSession

Page 146: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNViewDelegate

ARSCNViewDelegate

ARSCNView

Page 147: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNViewDelegate

func session(_: ARSession, didAdd: [ARAnchor])

ARSCNViewDelegate

ARSCNView

Page 148: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNViewDelegate

func session(_: ARSession, didAdd: [ARAnchor])

ARSCNViewDelegate

ARSCNView

func renderer(_: SCNSceneRenderer, nodeFor: ARAnchor) -> SCNNode?

Page 149: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SceneKit ARSCNViewDelegate

func session(_: ARSession, didAdd: [ARAnchor])

ARSCNViewDelegate

ARSCNView

func renderer(_: SCNSceneRenderer, didAdd: SCNNode, for: ARAnchor)

func renderer(_: SCNSceneRenderer, nodeFor: ARAnchor) -> SCNNode?

Page 150: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSCNViewDelegate

ARSCNView

SceneKit ARSCNViewDelegate

Page 151: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func session(_: ARSession, didUpdate: [ARAnchor])

ARSCNViewDelegate

ARSCNView

SceneKit ARSCNViewDelegate

Page 152: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func session(_: ARSession, didUpdate: [ARAnchor])

ARSCNViewDelegate

ARSCNView

func renderer(_: SCNSceneRenderer, willUpdate: SCNNode, for: ARAnchor)

SceneKit ARSCNViewDelegate

Page 153: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func session(_: ARSession, didUpdate: [ARAnchor])

ARSCNViewDelegate

ARSCNView

func renderer(_: SCNSceneRenderer, didUpdate: SCNNode, for: ARAnchor)

func renderer(_: SCNSceneRenderer, willUpdate: SCNNode, for: ARAnchor)

SceneKit ARSCNViewDelegate

Page 154: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARSCNViewDelegate

ARSCNView

SceneKit ARSCNViewDelegate

Page 155: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func session(_: ARSession, didRemove: [ARAnchor])

ARSCNViewDelegate

ARSCNView

SceneKit ARSCNViewDelegate

Page 156: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func session(_: ARSession, didRemove: [ARAnchor])

ARSCNViewDelegate

ARSCNView

func renderer(_: SCNSceneRenderer, didRemove: SCNNode, for: ARAnchor)

SceneKit ARSCNViewDelegate

Page 157: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SpriteKit ARSKView

Page 158: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SpriteKit ARSKView

Contains ARSession

Page 159: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SpriteKit ARSKView

Contains ARSession

Draws captured image

Page 160: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SpriteKit ARSKView

Contains ARSession

Draws captured image

Maps SKNodes to ARAnchors

Page 161: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

SpriteKit ARSKView

Contains ARSession

Draws captured image

Maps SKNodes to ARAnchors

Sprites are billboarded to physical locations

Page 162: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Going Beyond 2D with SpriteKit Executive Ballroom Friday 10:00AM

SpriteKit ARSKView

Contains ARSession

Draws captured image

Maps SKNodes to ARAnchors

Sprites are billboarded to physical locations

Page 163: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Processing

Page 164: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Processing

Draw camera background

Page 165: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Processing

Draw camera background

Update virtual camera

Page 166: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Processing

Draw camera background

Update virtual camera

Update lighting

Page 167: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Processing

Draw camera background

Update virtual camera

Update lighting

Update transforms for geometry

Page 168: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Polling

Custom Rendering Accessing ARFrame

if let frame = mySession.currentFrame { if( frame.timestamp > _lastTimestamp ) { updateRenderer(frame) // Update renderer with frame _lastTimestamp = frame.timestamp } }

Page 169: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Polling

Custom Rendering Accessing ARFrame

func session(_ session: ARSession, didUpdate frame: ARFrame) { // Update renderer with frame updateRenderer(frame) }

if let frame = mySession.currentFrame { if( frame.timestamp > _lastTimestamp ) { updateRenderer(frame) // Update renderer with frame _lastTimestamp = frame.timestamp } }

Delegate

Page 170: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func updateRenderer(_ frame: ARFrame) {

// Draw background camera image drawCameraImage(withPixelBuffer: frame.capturedImage)

// Update virtual camera let viewMatrix = simd_inverse(frame.camera.transform) let projectionMatrix = frame.camera.projectionMatrix updateCamera(viewMatrix, projectionMatrix)

// Update lighting updateLighting(frame.lightEstimate?.ambientIntensity)

// Update geometry based on anchors drawGeometry(forAnchors: frame.anchors) }

Page 171: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func updateRenderer(_ frame: ARFrame) {

// Draw background camera image drawCameraImage(withPixelBuffer: frame.capturedImage)

// Update virtual camera let viewMatrix = simd_inverse(frame.camera.transform) let projectionMatrix = frame.camera.projectionMatrix updateCamera(viewMatrix, projectionMatrix)

// Update lighting updateLighting(frame.lightEstimate?.ambientIntensity)

// Update geometry based on anchors drawGeometry(forAnchors: frame.anchors) }

Page 172: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func updateRenderer(_ frame: ARFrame) {

// Draw background camera image drawCameraImage(withPixelBuffer: frame.capturedImage)

// Update virtual camera let viewMatrix = simd_inverse(frame.camera.transform) let projectionMatrix = frame.camera.projectionMatrix updateCamera(viewMatrix, projectionMatrix)

// Update lighting updateLighting(frame.lightEstimate?.ambientIntensity)

// Update geometry based on anchors drawGeometry(forAnchors: frame.anchors) }

Page 173: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func updateRenderer(_ frame: ARFrame) {

// Draw background camera image drawCameraImage(withPixelBuffer: frame.capturedImage)

// Update virtual camera let viewMatrix = simd_inverse(frame.camera.transform) let projectionMatrix = frame.camera.projectionMatrix updateCamera(viewMatrix, projectionMatrix)

// Update lighting updateLighting(frame.lightEstimate?.ambientIntensity)

// Update geometry based on anchors drawGeometry(forAnchors: frame.anchors) }

Page 174: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

func updateRenderer(_ frame: ARFrame) {

// Draw background camera image drawCameraImage(withPixelBuffer: frame.capturedImage)

// Update virtual camera let viewMatrix = simd_inverse(frame.camera.transform) let projectionMatrix = frame.camera.projectionMatrix updateCamera(viewMatrix, projectionMatrix)

// Update lighting updateLighting(frame.lightEstimate?.ambientIntensity)

// Update geometry based on anchors drawGeometry(forAnchors: frame.anchors) }

Page 175: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARFrame

Custom Rendering Drawing to a viewport

Page 176: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

ARFrame

Custom Rendering Drawing to a viewport

Page 177: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Drawing to a viewport

ARFrame

Page 178: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Drawing to a viewport

ARFrame

Page 179: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Custom Rendering Drawing to a viewport

Page 180: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Helper methods

Custom Rendering Drawing to a viewport

Page 181: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Helper methods

Custom Rendering Drawing to a viewport

// Get the frame’s display transform for the given viewport size and orientation let transform = frame.displayTransform(withViewportSize: viewportSize, orientation: .portrait)

Page 182: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Helper methods

Custom Rendering Drawing to a viewport

// Get the frame’s display transform for the given viewport size and orientation let transform = frame.displayTransform(withViewportSize: viewportSize, orientation: .portrait)

// Get the camera’s projection matrix for the given viewport size and orientation let projectionMatrix = camera.projectionMatrix(withViewportSize: viewportSize, orientation: .portrait, zNear: 0.001, zFar: 1000)

Page 183: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Summary

High-level API

Tracking

Scene Understanding

Rendering

Page 184: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

More Informationhttps://developer.apple.com/wwdc17/602

Page 185: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Related Sessions

Sessions have been confirmedIntroducing Metal Executive Ballroom Tuesday 1:50PM

SceneKit: What's New Grand Ballroom A Wednesday 11:00AM

Going Beyond 2D with SpriteKit Executive Ballroom Friday 10:00AM

Page 186: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor

Labs

Sessions have been confirmedARKit Lab Technology Lab A Wed 1:00PM–3:00PM

AR/VR Get Together Technology Lab A Wed 6:30-7:45PM

ARKit Lab Technology Lab A Thu 12:00PM–3:00PM

Page 187: •Introducing ARKit Augmented Reality for iOS - Apple Inc. · Augmented Reality Computer Vision Surface Estimation Scene Understanding Feature Detection Bundle Adjustment Sensor