NatML
Search…
MLDepthFeature
abstract class NatML.Features.MLDepthFeature : MLFeature
This feature is used to provide depth data to predictors that require such data. Implementers can derive from this class and provide custom logic for sampling depth given a pixel location.

Creating the Feature

/// <summary>
/// Initialize the depth feature with the depth map dimensions.
/// </summary>
/// <param name="width">Depth map width.</param>
/// <param name="height">Depth map height.</param>
protected MLDepthFeature (int width, int height);
INCOMPLETE.
/// <summary>
/// Initialize the depth feature with the depth map feature type.
/// </summary>
/// <param name="type">Depth map feature type.</param>
protected MLDepthFeature (MLImageType type);

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; }
Refer to the Inspecting the Feature section of the MLFeature class for more information.
The type is always an MLImageType.

Depth Map Width

/// <summary>
/// Depth map width.
/// </summary>
int width { get; }
The depth feature provides this convenience property for accessing the width of the feature type.

Depth Map Height

/// <summary>
/// Depth map height.
/// </summary>
int height { get; }
The depth feature provides this convenience property for accessing the height of the feature type.

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>
abstract float Sample (Vector2 point);
INCOMPLETE.
The point is specified in normalized coordinates, and as such must be in range [0.0, 1.0].

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>
abstract Vector3 ViewportToWorldPoint (Vector2 point);
INCOMPLETE.
The point is specified in normalized coordinates, and as such must be in range [0.0, 1.0].
Copy link
On this page
Creating the Feature
Inspecting the Feature
Feature Type
Depth Map Width
Depth Map Height
Sampling Pixel Depth
Projecting to 3D Space