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 Video Info
  • From a Video File
  • From a VideoClip
  • From Streaming Assets
  • Inspecting the Type
  • Inspecting the Video
  • Video Width
  • Video Height
  • Video Channels
  • Video Frames
  • Pixel Layout

Was this helpful?

  1. API Reference
  2. MLFeatureType

MLVideoType

class NatML.Types.MLVideoType : MLImageType

The video type describes video features.

Creating the Type

The video type can be created with video information, or by inspecting a video file:

From Video Info

/// <summary>
/// Create an video feature type.
/// </summary>
/// <param name="width">Video width.</param>
/// <param name="height">Video height.</param>
/// <param name="frames">Video frame count.</param>
MLVideoType (int width, int height, int frames);

INCOMPLETE.

/// <summary>
/// Create an video feature type.
/// </summary>
/// <param name="width">Video width.</param>
/// <param name="height">Video height.</param>
/// <param name="frames">Video frame count.</param>
/// <param name="type">Video frame data type.</param>
MLVideoType (int width, int height, int frames, Type type);

INCOMPLETE.

/// <summary>
/// Create an video feature type.
/// </summary>
/// <param name="shape">Video feature shape.</param>
/// <param name="type">Video frame data type.</param>
/// <param name="name">Feature name.</param>
MLVideoType (int[] shape, Type type, string name = default);

From a Video File

/// <summary>
/// Get the video type for a video file at a given path.
/// </summary>
/// <param name="path">Video path.</param>
/// <returns>Corresponding video type or `null` if file is not a valid video file.</returns>
static MLVideoType FromFile (string path);

INCOMPLETE.

/// <summary>
/// Get the video type for a video clip.
/// Note that the frame count is merely an estimate based on the duration of the video.
/// </summary>
/// <param name-"clip">Video clip.</param>
/// <returns>Corresponding video type.</returns>
static MLVideoType FromVideoClip (VideoClip clip);

INCOMPLETE.

From Streaming Assets

/// <summary>
/// Get the video type for a video file in the `StreamingAssets` folder.
/// </summary>
/// <param name="relativePath">Relative path to video file in `StreamingAssets` folder.</param>
/// <returns>Corresponding video type or `null` if the file is not a valid video file.</returns>
static Task<MLVideoType> FromStreamingAssets (string relativePath);

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 Video

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

Video Width

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

Video Height

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

Video Channels

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

Video Frames

/// <summary>
/// Video frame count.
/// Note that this is almost always an approximate count.
/// </summary>
int frames { get; }

The video type reports the number of frames contained in the video.

Pixel Layout

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

Last updated 2 years ago

Was this helpful?

From a

Refer to 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.

Note that the frame count reported by the video type is always an estimate. To get an exact count, enumerate the .

Refer to the section of the class for more information.

VideoClip
MLFeatureType
MLImageType
MLImageType
MLImageType
MLImageType
MLVideoFeature
Image Width
Image Height
Image Channels
Pixel Layout