Unity
  • NatML for Unity
  • Preliminaries
    • Getting Started
    • Requirements
  • Workflows
    • Core Concepts
    • Fetching Models
    • Using Predictors
  • Authoring
    • Creating Predictors
    • Distributing Predictors
  • API Reference
    • IMLPredictor
    • MLModel
      • MLEdgeModel
        • Configuration
      • MLCloudModel
    • MLFeature
      • MLArrayFeature
      • MLImageFeature
      • MLStringFeature
      • MLAudioFeature
      • MLVideoFeature
      • MLDepthFeature
      • MLXRCpuDepthFeature
    • MLFeatureType
      • MLArrayType
      • MLAudioType
      • MLImageType
      • MLVideoType
      • MLStringType
    • MLPredictorExtensions
  • Integrations
    • Media Devices
    • Augmented Reality
    • Video Recording
  • Insiders
    • Changelog
    • Open Source
    • GitHub
    • Discord
    • Blog
Powered by GitBook
On this page
  • Creating the Feature
  • Inspecting the Feature
  • Feature Type
  • Depth Map Width
  • Depth Map Height
  • Sampling Pixel Depth
  • Projecting to 3D Space

Was this helpful?

  1. API Reference
  2. MLFeature

MLXRCpuDepthFeature

class MLXRCpuDepthFeature : MLDepthFeature

PreviousMLDepthFeatureNextMLFeatureType

Last updated 2 years ago

Was this helpful?

This feature provides functionality for working with camera depth data from Unity ARFoundation.

This class is distributed in the integration library.

Creating the Feature

/// <summary>
/// Create an AR depth image feature.
/// </summary>
/// <param name="image">Augmented reality image.</param>
/// <param name="camera">AR session camera.</param>
/// <param name="orientation">Image orientation. If `Unknown`, this will default to the screen orientation.</param>
MLXRCpuDepthFeature (XRCpuImage image, Camera camera, ScreenOrientation orientation = 0);

INCOMPLETE.

Inspecting the Feature

The depth feature exposes its underlying type, along with convenience properties for inspecting the aforementioned type.

Feature Type

/// <summary>
/// Feature type.
/// </summary>
MLFeatureType type { get; }

Depth Map Width

/// <summary>
/// Depth map width.
/// </summary>
int width { get; }

Depth Map Height

/// <summary>
/// Depth map height.
/// </summary>
int height { get; }

Sampling Pixel Depth

/// <summary>
/// Sample the depth feature at a given point.
/// </summary>
/// <param name="point">Point to sample in normalized coordinates.</param>
/// <returns>Depth in meters.</returns>
float Sample (Vector2 point);

Projecting to 3D Space

/// <summary>
/// Project a 2D point into 3D world space using depth.
/// </summary>
/// <param name="point">Point to transform in normalized camera coordinates.</param>
/// <returns>Projected point in 3D world space.</param>
Vector3 ViewportToWorldPoint (Vector2 point);

Refer to the section of the class for more information.

Refer to the section of the class for more information.

Refer to the section of the class for more information.

Refer to the section of the class for more information.

Refer to the section of the class for more information.

ai.natml.natml.arfoundation
MLDepthFeature
MLDepthFeature
MLDepthFeature
MLDepthFeature
Depth Map Width
Depth Map Height
Sampling Pixel Depth
Projecting to 3D Space
MLDepthFeature
Inspecting the Feature