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
Public Method Summary
onNewItem(int id, T item)
This method is called to initially assert a new item when it is detected.
Inherited Method Summary
public Tracker ()
public void onDone ()
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
onUpdate(Detector.Detections would then be called.
|detections||full detection results for the frame and associated frame metadata|
public void onNewItem (int id, T item)
onUpdate(Detector.Detections is always called immediately following this method call, with the same
item that was passed into this method.
|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
onNewItem(int, Object). That is, it has been determined to be the same tracked
item as was initially seen.
|detections||full detection results and associated frame metadata|
|item||detection information for the tracker's associated item|