ARWorldTrackingConfiguration

A configuration that uses the back-facing camera, tracks a device's orientation and position, and detects real-world flat surfaces.

使用背面照相機的配置,跟蹤設備的方向和位置,并檢測真實世界的平面。


Overview

All AR configurations establish a correspondence between the real world the device inhabits and a virtual 3D coordinate space where you can model content. When your app displays that content together with a live camera image, the user experiences the illusion that your virtual content is part of the real world.?

Creating and maintaining this correspondence between spaces requires tracking the device's motion. The?ARWorldTrackingConfiguration?class tracks the device's movement with six degrees of freedom (6DOF): specifically, the three rotation axes (roll, pitch, and yaw), and three translation axes (movement in x, y, and z).

This kind of tracking can create immersive AR experiences: A virtual object can appear to stay in the same place relative to the real world, even as the user tilts the device to look above or below the object, or moves the device around to see the object's sides and back.

概述

所有AR配置都可以在設備居住的真實世界與虛擬3D坐標空間之間建立對應關系,您可以在其中對內容進行建模。 當您的應用程序將該內容與實時相機圖像一起顯示時,用戶會體驗到虛擬內容是真實世界的一部分的錯覺。

在空間之間創建和維護這種對應關系需要跟蹤設備的運動。 ARWorldTrackingConfiguration類以六個自由度(6DOF)跟蹤設備的運動:特別是三個旋轉軸(滾動,俯仰和偏航)以及三個平移軸(在x,y和z中的移動)。

這種追蹤可以創造逼真的AR體驗:虛擬物體可以看起來與真實世界保持相同的位置,即使用戶將設備傾斜到物體的上方或下方,或者移動設備以查看 物體的側面和背面。


If you enable the?planeDetection?setting, ARKit analyzes the scene to find real-world horizontal or vertical surfaces. For each plane detected, ARKit automatically adds an?ARPlaneAnchor?object to the session.?

If you provide images for the detectionImages property, ARKit analyzes the scene to recognize those images. For each detected image, ARKit automatically adds an?ARImageAnchor?object to the session.

如果啟用planeDetection設置,ARKit將分析場景以查找真實世界的水平或垂直表面。 對于檢測到的每個平面,ARKit會自動將ARPlaneAnchor對象添加到會話中。

如果您為detectionImages屬性提供圖像,ARKit會分析場景以識別這些圖像。 對于每個檢測到的圖像,ARKit會自動將ARImageAnchor對象添加到會話中。


? ? ? ? ? ? ? ? ? ? ? ? ? Creating a Configuration


-?init
Creates a new world tracking configuration.
創建新的世界跟蹤配置。

+?new


? ? ? ? ? ? ? ? ? ? ? ? ?Enabling Plane Detection


planeDetection
A value specifying whether and how the session attempts to automatically detect flat surfaces in the camera-captured image.
一個值用來表明是否開啟平面檢測以及判別是哪種平面的值。

Discussion

By default, plane detection is off. If you enable?ARPlaneDetectionHorizontal?or?ARPlaneDetectionVertical?plane detection, the session adds?ARPlaneAnchor?objects and notifies your?ARSessionDelegate,?ARSCNViewDelegate, or?ARSKViewDelegate?object whenever its analysis of captured video images detects an area that appears to be a flat surface.

討論

默認情況下,平面檢測已關閉。 如果啟用ARPlaneDetectionHorizontal或ARPlaneDetectionVertical平面檢測,會話將添加ARPlaneAnchor對象,并在其捕獲的視頻圖像的分析檢測到看似平坦的區域時,通知您的ARSessionDelegate,ARSCNViewDelegate或ARSKViewDelegate對象。

ARPlaneDetection
Options for whether and how ARKit detects flat surfaces in captured images.
ARKit是否以及如何檢測拍攝圖像中的平坦表面的選項。

Plane Detection Options

ARPlaneDetectionHorizontal
The session detects planar surfaces that are perpendicular to gravity.
會話檢測垂直于重力的平面。

ARPlaneDetectionVertical
The session detects surfaces that are parallel to gravity (regardless of other orientation).
會話檢測平行于重力的平面。

ARPlaneDetectionNone
Plane detection is disabled.
平面檢測不可用


? ? ? ? ? ? ? ? ? ? ? Enabling Image Detection


detectionImages
A set of images for ARKit to attempt to detect in the user's environment.
ARKit嘗試在用戶環境中檢測的一組圖像。

Discussion

Use this property to choose known 2D images for ARKit to find in the user's environment and present as?ARImageAnchor?for use in your AR experience. Use Xcode to define reference images for ARKit to detect, or define them programmatically with the?ARReferenceImageclass.?

For example, you might use this feature to create a AR experience where, when the user encounters a certain movie poster, space ships or cartoon characters appear to emerge from the poster and inhabit the user's environment.

討論

使用此屬性可以為ARKit選擇已知的2D圖像,以便在用戶環境中查找并以ARImageAnchor的形式顯示,以便用于您的AR體驗。 使用Xcode為ARKit定義參考圖像來檢測,或使用ARReferenceImageclass以編程方式定義它們。

例如,您可以使用此功能創建AR體驗,其中當用戶遇到某個電影海報時,太空飛船或卡通人物會從海報中浮現出來,并置身于用戶的環境中。


? ? ? ? ? ? ? ? ? ? ? ?Managing Device Camera Behavior


autoFocusEnabled
A Boolean value that determines whether the device camera uses fixed focus or autofocus behavior.
一個布爾值,用于確定設備相機是使用固定焦點還是自動聚焦行為。

Discussion

In apps linked against the iOS 11.3 SDK or later, ARKit enables autofocus by default.
在與iOS 11.3 SDK或更高版本鏈接的應用程序中,ARKit默認啟用自動對焦。


Inherits From ? ?ARConfiguration

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 227,818評論 6 531
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 98,185評論 3 414
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 175,656評論 0 373
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 62,647評論 1 309
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 71,446評論 6 405
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 54,951評論 1 321
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,041評論 3 440
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,189評論 0 287
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 48,718評論 1 333
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 40,602評論 3 354
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 42,800評論 1 369
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,316評論 5 358
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,045評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,419評論 0 26
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 35,671評論 1 281
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,420評論 3 390
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 47,755評論 2 371

推薦閱讀更多精彩內容