class ARSemanticSegmentationManager (Niantic.ARDK.Extensions.ARSemanticSegmentationManager)

Overview

class ARSemanticSegmentationManager: Niantic.ARDK.Rendering.ARRenderFeatureProvider {
public:
    // properties

    Camera Camera;
    Texture DepthSuppressionTexture;
    InterpolationMode Interpolation;
    float InterpolationPreference;
    uint KeyFrameFrequency;
    ISemanticBufferProcessor SemanticBufferProcessor;

    // events

    event SemanticBufferInitialized();
    event SemanticBufferUpdated();

    // methods

    virtual override void ApplyARConfigurationChange(ARSessionChangesCollector.ARSessionRunProperties properties);
    IDataBufferFloat32 GetConfidences(string channelName);
    bool GetConfidencesARGB32(ref Texture2D texture, string channelName);
    bool GetConfidencesRFloat(ref Texture2D texture, string channelName);
    bool GetThresholdedARGB32(ref Texture2D texture, string channelName);
    void SetConfidenceChannels(params string[] channelNames);
    void SetDepthSuppressionChannels(params string[] channelNames);
    virtual override void UpdateRenderState(Material material);
};

Inherited Members

public:
    // properties

    bool AreFeaturesEnabled;
    bool CanInitialize;
    bool Initialized;
    ISet<string> Features;
    RenderTarget? Target;
    ArdkEventHandler<RenderFeaturesChangedArgs> ActiveFeaturesChanged;
    ISet<string> Features;
    RenderTarget? Target;

    // events

    event ActiveFeaturesChanged();

    // methods

    void Deinitialize();
    void DisableFeatures();
    void EnableFeatures();
    void Initialize();
    virtual abstract void ApplyARConfigurationChange(ARSessionChangesCollector.ARSessionRunProperties properties) = 0;
    void UpdateRenderState(Material material);
    virtual abstract void UpdateRenderState(Material material) = 0;

Detailed Documentation

Properties

Camera Camera

Returns a reference to the scene camera used to render AR content, if present.

Texture DepthSuppressionTexture

Returns a reference to the depth suppression mask texture, if present. If the suppression feature is disabled, this returns null.

InterpolationMode Interpolation

The value specifying whether the semantics buffer should synchronize with the camera pose.

float InterpolationPreference

The value specifying whether to align semantics pixels with closer (0.1) or distant (1.0) pixels in the color image (aka the back-projection distance).

uint KeyFrameFrequency

The value specifying the how many times the semantic segmentation routine should target running per second.

Events

event SemanticBufferInitialized()

Event for when the first semantics buffer is received.

event SemanticBufferUpdated()

Event for when the contents of the semantic buffer or its affine transform was updated.

Methods

virtual override void ApplyARConfigurationChange(ARSessionChangesCollector.ARSessionRunProperties properties)

Inheritors should override this to modify session configuration settings based on their script’s needs.

Note

This is executed as a result of the ARSession being run, which may or may not be triggered by a call to RaiseConfigurationChanged().

IDataBufferFloat32 GetConfidences(string channelName)

Returns the cached confidence buffer for the specified channel, if exists.

Parameters:

channelName

The name of the channel to acquire the confidence buffer for.

Returns:

32-bit floating point awareness buffer in CPU memory. The buffer is owned by the manager and will get invalidated on the next semantics update.

bool GetConfidencesARGB32(ref Texture2D texture, string channelName)

Creates or updates the specified texture with a confidence buffer if it exists in cache.

Parameters:

texture

The texture to copy the confidences to. If the texture is null, it will be created. Deallocating this texture is the caller’s responsibility.

channelName

The name of the channel to acquire the confidence texture for.

Returns:

Whether the values have been successfully copied to the texture.

bool GetConfidencesRFloat(ref Texture2D texture, string channelName)

Creates or updates the specified texture with a confidence buffer if it exists in cache.

Parameters:

texture

The texture to copy the confidences to. If the texture is null, it will be created. Deallocating this texture is the caller’s responsibility.

channelName

The name of the channel to acquire the confidence texture for.

Returns:

Whether the values have been successfully copied to the texture.

bool GetThresholdedARGB32(ref Texture2D texture, string channelName)

Creates or updates the texture with data of the specified semantic channel. The texture will contain thresholded values where 1 means the pixel is classified as the requested semantic channel.

Parameters:

texture

Reference to the texture to copy to. This method will create a texture if the reference is null.

channelName

Channel name of the semantic class to copy.

Returns:

Whether the values have been successfully copied to the texture.

void SetConfidenceChannels(params string[] channelNames)

The manager can maintain the confidence buffers of select semantic channels in cache. This method updates the list of channels to maintain.

void SetDepthSuppressionChannels(params string[] channelNames)

Sets the depth suppression channels. If there is an existing set of channels, calling this method will override them.

virtual override void UpdateRenderState(Material material)

Called when it is time to copy the current render state to the main rendering material.

Parameters:

material

Material used to render the frame.