Chapter 04

DepthMapとConfidenceMapの違い

A
A
2022.01.02に更新

Class AROcclusionManager

https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/api/UnityEngine.XR.ARFoundation.AROcclusionManager.html

TryAcquireEnvironmentDepthCpuImage

Attempt to get the latest environment depth CPU image. This provides directly access to the raw pixel data.

unsafe void UpdateEnvironmentDepthImage() {
        if(!arOcclusionManager.TryAcquireEnvironmentDepthCpuImage(out XRCpuImage xrCpuImage)) {
            return;
        }

using(xrCpuImage) {
...

TryAcquireEnvironmentDepthConfidenceCpuImage

Attempt to get the latest environment depth confidence CPU image. This provides directly access to the raw pixel data.

unsafe void UpdateEnvironmentDepthConfidenceImage() {
        if(!arOcclusionManager.TryAcquireEnvironmentDepthConfidenceCpuImage(out XRCpuImage xrCpuImage)) {
            return;
        }

using(xrCpuImage) {
...

environmentDepthTexture

The environment depth texture.

environmentDepthConfidenceTexture

The environment depth confidence texture.

environment depth textureとenvironment depth confidence textureの違い

ARDepthData

https://developer.apple.com/documentation/arkit/ardepthdata
  • Every pixel in the depthMap maps to a region of the visible scene (capturedImage), where the pixel value defines that region’s distance from the plane of the camera in meters.

  • The confidenceMap property measures the accuracy of the corresponding depth data in depthMap, and is useful in filtering out lower-accuracy depth values if an app’s algorithm required it.

Ref:ここから始まるお手軽地形計測 iPhoneへLiDARスキャナ搭載【ARKit】

https://tech.aptpod.co.jp/entry/2020/12/22/100000

信頼度マップのデータはARConfidenceLevelという列挙型で定義された範囲で出力され、最小値はARConfidenceLevel.lowの0、最大値がARConfidenceLevel.highの2です。 ですのでモノクロ画像として表示でよければ場合は0~255の範囲に変換してからUIImage化する必要があります。

つまり

  • environment depth textureは、depth dataがtextureになったもの。その距離はfloat

  • environment depth confidence textureは、depthの信頼度を0, 1, 2で示したもの。