A tracker is used to receive notifications for a detected item over time. Subclasses should override the relevant methods below to implement the logic associated with tracking an item in a particular way.
Note that Tracker requires the Detector return stable IDs across frames for the same
object. As a result, some Detectors (such as TextRecognizer) currently do not work well
with Tracker, and developers may need to implement their own tracking mechanism.
Public Constructor Summary
|
Tracker()
|
Public Method Summary
| void |
onDone()
Called to indicate that the item associated with the ID previously reported via
onNewItem(int, Object) has been assumed to be gone forever. |
| void |
onMissing(Detections<T> detections)
Called if either the tracked item was not detected at all in a frame, or if the specific item
identity associated with the tracker is not present in the current frame.
|
| void |
onNewItem(int id, T item)
This method is called to initially assert a new item when it is detected.
|
| void |
onUpdate(Detections<T> detections, T item)
As an item is detected over time, this method is called to give an update for the item in the
context of the overall detection.
|
Inherited Method Summary
Public Constructors
public Tracker ()
Public Methods
public void onDone ()
Called to indicate that the item associated with the ID previously reported via onNewItem(int, Object) has been assumed to be gone forever.
public void onMissing (Detections<T> detections)
Called if either the tracked item was not detected at all in a frame, or if the specific item
identity associated with the tracker is not present in the current frame. It's possible that
the item may be missed for a few frames, and will reappear later, depending upon the detector
settings. onUpdate(Detector.Detections would then be called.
Parameters
| detections | full detection results for the frame and associated frame metadata |
|---|
public void onNewItem (int id, T item)
This method is called to initially assert a new item when it is detected. The ID will remain
constant for all calls to onUpdate(Detector.Detections until onDone() is called.
onUpdate(Detector.Detections is always called immediately following this method call, with the same
item that was passed into this method.
Parameters
| id | ID representing the specific detected item |
|---|---|
| item | detection information for the newly detected item |
public void onUpdate (Detections<T> detections, T item)
As an item is detected over time, this method is called to give an update for the item in the
context of the overall detection. Each item that is received has the same ID as the most recent
call of onNewItem(int, Object). That is, it has been determined to be the same tracked
item as was initially seen.
Parameters
| detections | full detection results and associated frame metadata |
|---|---|
| item | detection information for the tracker's associated item |
