AI-generated Key Takeaways
-
DetectedObject
represents an object identified by the ML Kit ObjectDetector, providing information about its location and potentially its classification. -
It offers methods to access the object's bounding box, labels (if classification is enabled), and tracking ID (in stream mode).
-
Labels associated with the object are sorted by confidence, and an empty list is returned if classification is disabled or no labels meet the confidence threshold.
-
Tracking ID is a non-negative number in stream mode and null in single image mode, helping to track the object across frames.
-
DetectedObject
inherits standard methods fromjava.lang.Object
such asequals
,hashCode
, andtoString
.
Represents an object detected by ObjectDetector
.
Nested Class Summary
class | DetectedObject.Label | Represents an image label of a detected object. |
Public Method Summary
boolean | |
Rect |
getBoundingBox()
Gets the axis-aligned bounding rectangle of the detected object.
|
List<DetectedObject.Label> |
getLabels()
Returns a list of
DetectedObject.Label
for the detected object, when classification is enabled.
|
Integer |
getTrackingId()
Gets the tracking ID of the object.
|
int |
hashCode()
Returns a hash code value for the object.
|
Inherited Method Summary
Public Methods
public boolean equals (Object o)
Indicates whether some other object is "equal to" this one.
public Rect getBoundingBox ()
Gets the axis-aligned bounding rectangle of the detected object.
public List<DetectedObject.Label> getLabels ()
Returns a list of DetectedObject.Label
for the detected object, when classification is enabled.
The labels are returned sorted by confidence in descending order.
An empty list will be returned if classification is not enabled or there isn't any label with a confidence score greater than the threshold.
public Integer getTrackingId ()
Gets the tracking ID of the object.
The ID is a non-negative number in
ObjectDetectorOptionsBase.STREAM_MODE
and null
in
ObjectDetectorOptionsBase.SINGLE_IMAGE_MODE
.
public int hashCode ()
Returns a hash code value for the object.