class XRObjectDetectionSubsystem
(Niantic.Lightship.AR.XRSubsystems.XRObjectDetectionSubsystem)
Overview
Defines an interface for interacting with object detection functionality.
class XRObjectDetectionSubsystem:
SubsystemWithProvider< XRObjectDetectionSubsystem, XRObjectDetectionSubsystemDescriptor, XRObjectDetectionSubsystem.Provider >,
ISubsystemWithModelMetadata {
public:
class Provider;
// properties
uint TargetFrameRate;
bool IsMetadataAvailable;
uint? LatestFrameId;
bool IsStabilizationEnabled;
// 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.
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.
Parameters:
System.NotSupportedException
- Thrown if configuring stabilization is not supported by the implementation.
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.