Skip to main content
Version: 3.3

class XRObjectDetectionSubsystem

(Niantic.Lightship.AR.XRSubsystems.XRObjectDetectionSubsystem)

Overview

Defines an interface for interacting with object detection functionality.

	class XRObjectDetectionSubsystem: SubsystemWithProvider< XRObjectDetectionSubsystem, XRObjectDetectionSubsystemDescriptor, XRObjectDetectionSubsystem.Provider > {
public:

class Provider;

// properties

uint TargetFrameRate;
bool IsMetadataAvailable;
uint? LatestFrameId;

// methods

bool TryGetCategoryNames(out IReadOnlyList<string> names);
bool TryGetDetectedObjects(out XRDetectedObject[] results);
XRObjectDetectionSubsystem();
static bool Register(XRObjectDetectionSubsystemCinfo cinfo);
};

Detailed Documentation

Defines an interface for interacting with object detection functionality.

This is an experimental feature. Experimental features are subject to breaking changes, not officially supported, and may be deprecated without notice.

Properties

TargetFrameRate

uint TargetFrameRate

Specifies the target frame rate for the platform to target running the object detection algorithm at.

The target frame rate.

This is an experimental API. Experimental features are subject to breaking changes, not officially supported, and may be deprecated without notice.

    Parameters:

    System.NotSupportedException - Thrown if frame rate configuration is not supported.

IsMetadataAvailable

bool IsMetadataAvailable

Is true if metadata has been downloaded and decrypted on the current device. Only if this value is true can the object detection category names or results be acquired.

If metadata is available.

This is an experimental API. Experimental features are subject to breaking changes, not officially supported, and may be deprecated without notice.

    Parameters:

    System.NotSupportedException - Thrown frame rate configuration is not supported.

LatestFrameId

uint? LatestFrameId

Returns the frame id of the most recent object detection output.

The frame id.

This is an experimental API. Experimental features are subject to breaking changes, not officially supported, and may be deprecated without notice.

    Parameters:

    System.NotSupportedException - Thrown if getting frame id is not supported.

Methods

TryGetCategoryNames

bool TryGetCategoryNames(out IReadOnlyList<string> names)

Tries to get a list of the object detection category names for the current model.

This is an experimental API. Experimental features are subject to breaking changes, not officially supported, and may be deprecated without notice.

    Parameters:

    names - A list of category names. It will be empty if the method returns false.

    System.NotSupportedException - Thrown when reading the category names is not supported by the implementation.

    Returns:

    True if category names are available. False if not.

TryGetDetectedObjects

bool TryGetDetectedObjects(out XRDetectedObject[] results)

Tries to acquire the latest object detection results from the camera image.

This is an experimental API. Experimental features are subject to breaking changes, not officially supported, and may be deprecated without notice.

    Parameters:

    results - An array of object detection instances.

    System.NotSupportedException - Thrown if the implementation does not support getting object detection results.

    Returns:

    Whether any object detection instances could be retrieved.

XRObjectDetectionSubsystem

XRObjectDetectionSubsystem()

Construct the subsystem by creating the functionality provider.

Register

static bool Register(XRObjectDetectionSubsystemCinfo cinfo)

Register the descriptor for the object detection subsystem implementation.

    Parameters:

    cinfo - The object detection subsystem implementation construction information.

    Returns:

    true if the descriptor was registered. Otherwise, false.