LoginSignup
0
0

More than 3 years have passed since last update.

解読 : ARKit2-最初のステップ 2/3 ARSession

Last updated at Posted at 2019-05-26

原文サイト
https://developer.apple.com/documentation/arkit/arsession

ARSession

A shared object that manages the device camera and motion processing needed for augmented reality experiences.
拡張現実の体験で必要となる、デバイスのカメラとモーションの処理を管理するための共有オブジェクト。

Declaration

class ARSession : NSObject

Overview

An ARSession object coordinates the major processes that ARKit performs on your behalf to create an augmented reality experience. These processes include reading data from the device's motion sensing hardware, controlling the device's built-in camera, and performing image analysis on captured camera images. The session synthesizes all of these results to establish a correspondence between the real-world space the device inhabits and a virtual space where you model AR content.

ARSessionオブジェクトは、ARKitがあなたに代わって実行する主なプロセスを調整して、拡張現実感体験を生み出します。 これらのプロセスには、デバイスのモーションセンシングハードウェアからのデータの読み取り、デバイスの内蔵カメラの制御、キャプチャしたカメラ画像の画像解析の実行などがあります。 セッションはこれらの結果すべてを統合して、デバイスが存在する現実の空間とARコンテンツをモデル化する仮想空間との間の対応関係を確立します。

Every AR experience built with ARKit requires a single ARSessionobject. If you use an ARSCNView or ARSKView object to easily build the visual part of your AR experience, the view object includes an ARSession instance. If you build your own renderer for AR content, you'll need to instantiate and maintain an ARSessionobject yourself.

ARKitで構築されたすべてのARエクスペリエンスには、単一のARSessionオブジェクトが必要です。 ARエクスペリエンスの視覚的部分を簡単に構築するためにARSCNViewまたはARSKViewオブジェクトを使用する場合、ビューオブジェクトにはARSessionインスタンスが含まれます。 ARコンテンツ用の独自のレンダラーを作成する場合は、ARSessionオブジェクトを自分でインスタンス化して維持する必要があります。

Running a session requires a configuration. Subclasses of the abstract ARConfiguration class determine how ARKit tracks a device's position and motion relative to the real world, and thus affect the kinds of AR experiences you can create. For example, use ARWorldTrackingConfiguration for experiences that augment the user's view of the world around them though the device's back camera.

セッションを実行するには設定が必要です。 抽象ARConfigurationクラスのサブクラスは、ARKitが実際の世界に対するデバイスの位置と動きをどのように追跡するかを決定し、作成できるARエクスペリエンスの種類に影響を与えます。 たとえば、ARWorldTrackingConfigurationを使用すると、デバイスのバックカメラを介して周囲のユーザーの視野を拡大することができます。

Topics : Configuring and Running a Session

func run(ARConfiguration, options: ARSession.RunOptions)

Starts AR processing for the session with the specified configuration and options.

struct ARSession.RunOptions

Options affecting how to transition an AR session's current state when you change its configuration.

var configuration: ARConfiguration?

An object that defines motion and scene tracking behaviors for the session.

func pause()

Pauses processing in the session.

Responding to AR Updates

var delegate: ARSessionDelegate?

An object you provide to receive captured video images and tracking information, or to respond to changes in session status.

var delegateQueue: DispatchQueue?

The dispatch queue through which the session calls your delegate methods.

protocol ARSessionDelegate

Methods you can implement to receive captured video frame images and tracking state from an AR session.

protocol ARSessionObserver

Methods you can implement to respond to changes in the state of an AR session.

Displaying and Interacting with AR Content

var currentFrame: ARFrame?

The video frame image, with associated AR scene information, most recently captured by the session.

func add(anchor: ARAnchor)

Adds the specified anchor to be tracked by the session.

func remove(anchor: ARAnchor)

Removes the specified anchor from tracking by the session.

Saving or Sharing Session State

func getCurrentWorldMap(completionHandler: (ARWorldMap?, Error?) -> Void)

Returns an object encapsulating the world-tracking session's space-mapping state and set of anchors.

Scanning 3D Objects for Detection

func createReferenceObject(transform: simd_float4x4, center: simd_float3, extent: simd_float3, completionHandler: (ARReferenceObject?, Error?) -> Void)

Creates a reference object (for 3D object detection) from the specified region of the session’s world space.

Updating the World Origin

func setWorldOrigin(relativeTransform: simd_float4x4)

Changes the basis for the AR world coordinate space using the specified transform.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0