Skip to main content

class XRDetectedObject

(Niantic.Lightship.AR.XRSubsystems.XRDetectedObject)

Overview

A class representing an object in the XR camera's view detected by the object detection model.

class XRDetectedObject {
public:
// properties

abstract float[] Confidences;

// methods

virtual abstract float GetConfidence(string categoryName) = 0;
virtual abstract List<XRObjectCategorization> GetConfidentCategorizations(float threshold = 0.4f) = 0;

virtual abstract Rect CalculateRect(
int viewportWidth,
int viewportHeight,
ScreenOrientation orientation
) = 0;
};

Detailed Documentation

A class representing an object in the XR camera's view detected by the object detection model.

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

Properties

Confidences

abstract float[] Confidences

The confidences of all the categories that can possibly be detected. The element at index i is the confidence for the category with index i.

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

Methods

GetConfidence

virtual abstract float GetConfidence(string categoryName) = 0

Gets the confidence value between 0 and 1.0 for the specified category for this detected object.

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

    Parameters:

    categoryName - The name of the category to query. This collection of valid names can be obtained from the XRObjectDetectionSubsystem.TryGetCategoryNames method

    Returns:

    The confidence value for the specified category for this detected object.

GetConfidentCategorizations

virtual abstract List<XRObjectCategorization> GetConfidentCategorizations(float threshold = 0.4f) = 0

Gets the object categorizations for this detected object.

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

    Parameters:

    threshold - The minimum confidence value needed for a categorization to be included in the returned list. Defaults to 0.4 if not provided.

    Returns:

    A list of all the confident categorizations for this detected object.

CalculateRect

virtual abstract Rect CalculateRect(
int viewportWidth,
int viewportHeight,
ScreenOrientation orientation
) = 0

The 2D bounding box of the detected object, transformed to be displayed in the given viewport. Usually this will be the same viewport the XR camera image is being rendered to.

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

    Parameters:

    viewportWidth - The pixel width of the viewport.

    viewportHeight - The pixel height of the viewport.

    orientation - The orientation of the viewport.

    Returns:

    The Rect describing the position and bounds of the detected object in the given viewport.