Class AROcclusionManager
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
-
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】
信頼度マップのデータは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で示したもの。