Skip to main content

class ARObjectDetectionManager

(Niantic.Lightship.AR.ObjectDetection.ARObjectDetectionManager)

Overview​

The manager for the object detection subsystem.

	class ARObjectDetectionManager: SubsystemLifecycleManager< XRObjectDetectionSubsystem, XRObjectDetectionSubsystemDescriptor, XRObjectDetectionSubsystem.Provider > {
public:
// fields

bool IsMetadataAvailable => subsystem?.IsMetadataAvailable ?? false;

// properties

uint??? TargetFrameRate;
bool??? IsStabilizationEnabled;
IReadOnlyList<string> CategoryNames;
Action<ARObjectDetectionModelEventArgs> MetadataInitialized;

// events

event ObjectDetectionsUpdated();

// methods

bool TryGetDetectedObjects(out XRDetectedObject[] results);

protected:
// methods

override void OnBeforeStart();
override void OnDisable();
};

Detailed Documentation​

The manager for the object detection subsystem.

Fields​

IsMetadataAvailable​

bool IsMetadataAvailable => subsystem?.IsMetadataAvailable ?? false

True if the underlying subsystem has finished initialization.

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

Properties​

TargetFrameRate​

uint??? TargetFrameRate

Frame rate that the object detection inference will aim to run at.

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

IsStabilizationEnabled​

bool??? IsStabilizationEnabled

When enabled, the object detection algorithm takes into account how many consecutive frames an object as been seen in, and how many frames a previously detected object has been unseen for, when determining which detections to surface. This has the effect of decreasing the possibility of spurious detections, but may also cause an increase in missed detections if framerate is low and the camera view is moving significantly between each frame.

True if stabilization is enabled.

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

CategoryNames​

IReadOnlyList<string> CategoryNames

The names of the object detection categories that the current model is able to detect. Will return an empty list if no metadata is available.

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

MetadataInitialized​

Action<ARObjectDetectionModelEventArgs> MetadataInitialized

An event which fires when the underlying subsystem has finished initializing.

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

Events​

ObjectDetectionsUpdated​

event ObjectDetectionsUpdated()

An event which fires when the underlying subsystem has made the set of detected objects for the latest input camera frame available.

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

Methods​

TryGetDetectedObjects​

bool TryGetDetectedObjects(out XRDetectedObject[] results)

Tries to acquire the most recent set of detected objects.

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 detected objects.If no objects were detected, this array will be empty.

    Returns:

    True if the object detection neural network has produced output.

OnBeforeStart​

override void OnBeforeStart()

Callback before the subsystem is started (but after it is created).

OnDisable​

override void OnDisable()

Callback when the manager is being disabled.