FocusingProcessor

Also: "vision"
public abstract class FocusingProcessor extends Object
implements Processor<T>

Base class for implementing a processor which filters the set of detection results, consistently delivering a single detected item to an associated Tracker.

Subclasses implement selectFocus(Detections) to define the criteria for initially selecting the detected item in which to "focus upon". Once selected, this same detected item will be sent to the tracker for as long as it exists in consecutive frames handled by a detector. That is, the tracking ID of the selected item, as included in the Detector.Detections.getDetectedItems() result, determines the selected item for subsequent frames. After the selected item is no longer visible, a new item will be selected as the focus.

For example, the code below creates and starts a pipeline that continuously receives preview frames from a camera source, runs detection on frames, and uses a focusing processor to continuously deliver a specific item of interest to a tracker over multiple frames.

detector.setProcessor(
   new MyFooFocusingProcessor(
     detector,
     new MyFooTracker()));

 CameraSource cameraSource = new CameraSource.Builder(context, detector)
   .build()
   .start();
 
Where "MyFooFocusingProcessor" is a subclass of FocusingProcessor and "MyFooTracker" is a subclass of Tracker, for an associated detector for finding "Foo" items.

Public Constructor Summary

FocusingProcessor(Detector<T> detector, Tracker<T> tracker)
Creates a focusing processor.

Public Method Summary

void
release()
Notifies the associated tracker that tracking has completed.
abstract int
selectFocus(Detections<T> detections)
Subclasses implement this method to select the item on which to focus.

Inherited Method Summary

Public Constructors

public FocusingProcessor (Detector<T> detector, Tracker<T> tracker)

Also: "vision"

Creates a focusing processor.

Parameters
detector associated detector instance which generates the detection results to be filtered by this focusing processor. This class calls back into Detector.setFocus(int) as a hint to the detector, allowing the detector to (optionally) choose to short circuit full frame detection if it is faster to just detect the focus item of interest.
tracker instance to receive notifications on the status of the focus item of interest.

Public Methods

public void release ()

Also: "vision"

Notifies the associated tracker that tracking has completed.

public abstract int selectFocus (Detections<T> detections)

Also: "vision"

Subclasses implement this method to select the item on which to focus.

Parameters
detections detection results received from a detector
Returns