Chapter 15: Tracking the User’s Face

前言

上一章只是做到叫ARKit開始進行人臉追蹤,這一章開始要根據ARKit辨識出來的內容進行應用。

大綱

Detecting the user’s face

  • ARKit辨識人臉結果後,會以ARFaceAnchor的物件傳出來。

  • 目前ARKit只能辨識單一人臉,若有多個人臉同時出現在鏡頭,只會挑出最大最容易辨識的那位。

  • 臉部座標系統是以右手方向為主軸且測量單位都是用公尺。

  • ARFaceAnchor中所有辨識出right選項,在真實世界是對應到使用者left(鏡射概念)。

Working with face geometry

  • Creating the Mask class

  • Using the Mask class

  • Connecting the mask to the anchor

    • 接下來要把mask node加到ARKit所辨識出來的face node下。

Handling updates

mask的幾何變化要根據人臉變化做即時的改變。

Adding additional mask & Connecting the switch button

這兩節主要只是更換不同的面具,並不是主要重點。

Setting up a basic environment

  • 調整環境光源,可以讓AR看起來更加真實。

Adjust the lighting

當在設定ARsession的config時,會加入isLightEstimationEnabled=true,此時ARKit就會透過下列delegate method回傳光源的相關資訊。可以根據光源的改變,及時調整scene的光源。

Last updated