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 Type
  • From Image Info
  • From a Feature Type
  • Inspecting the Type
  • Inspecting the Image
  • Image Width
  • Image Height
  • Image Channels
  • Pixel Layout

Was this helpful?

  1. API Reference
  2. MLFeatureType

MLImageType

class NatML.Types.MLImageType : MLArrayType

PreviousMLAudioTypeNextMLVideoType

Last updated 2 years ago

Was this helpful?

The image type describes image features.

Creating the Type

The image type can be created with image information, or by inspecting an :

From Image Info

/// <summary>
/// Create an image feature type.
/// </summary>
/// <param name="width">Image width.</param>
/// <param name="height">Image height.</param>
/// <param name="channels">Image channels.</param>
MLImageType (int width, int height, int channels = 3);

INCOMPLETE.

/// <summary>
/// Create an image feature type.
/// </summary>
/// <param name="width">Image width.</param>
/// <param name="height">Image height.</param>
/// <param name="type">Image data type.</param>
MLImageType (int width, int height, Type type);

INCOMPLETE.

/// <summary>
/// Create an image feature type.
/// This constructor assumes interleaved pixel buffers.
/// </summary>
/// <param name="width">Image width.</param>
/// <param name="height">Image height.</param>
/// <param name="channels">Image channels.</param>
/// <param name="type">Image data type.</param>
MLImageType (int width, int height, int channels, Type type);

INCOMPLETE.

/// <summary>
/// Create an image feature type.
/// </summary>
/// <param name="shape">Image feature shape.</param>
/// <param name="type">Image data type.</param>
/// <param name="name">Feature name.</param>
MLImageType (int[] shape, Type type, string name = null);

From a Feature Type

/// <summary>
/// Get the corresponding image type for a given feature type.
/// </summary>
/// <param name="type">Input type.</param>
/// <returns>Corresponding image type or `null` if input type is not an image type.</returns>
static MLImageType FromType (in MLFeatureType type);

INCOMPLETE.

Inspecting the Type

/// <summary>
/// Feature name.
/// </summary>
string name { get; }

/// <summary>
/// Feature data type.
/// This will typically be a numeric type.
/// </summary>
Type dataType { get; }

Inspecting the Image

The feature type reports information about the image it refers to:

Image Width

/// <summary>
/// Image width.
/// </summary>
int width { get; }

INCOMPLETE.

Image Height

/// <summary>
/// Image height.
/// </summary>
int height { get; }

INCOMPLETE.

Image Channels

/// <summary>
/// Image channels.
/// </summary>
int channels { get; }

INCOMPLETE.

The channel count is usually 1 for greyscale images, 3 for RGB images, or 4 for RGBA images.

Pixel Layout

/// <summary>
/// Whether the image is interleaved or planar.
/// </summary>
bool interleaved { get; }

Refer to the class for more information.

The image type reports the pixel layout of the image. The pixel layout is inferred from the of the type. If the channels dimension is last, then the image is interleaved; otherwise, the image is planar.

MLFeatureType
MLFeatureType
shape