FocusingProcessor Stay organized with collections Save and categorize content based on your preferences.
Base class for implementing aprocessor which filters the set of detection results, consistently delivering a single detected item to an associatedTracker.
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
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
| abstract void | receiveDetections(Detections<T> detections) Called by the detector to deliver detection results to the processor. |
| abstract void | release() Shuts down and releases associated processor resources. |
Public Constructors
publicFocusingProcessor(Detector<T> detector,Tracker<T> tracker)
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 intoDetector.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 abstract intselectFocus(Detections<T> detections)
Subclasses implement this method to select the item on which to focus.
Parameters
| detections | detection results received from a detector |
|---|
Returns
- the tracking ID of the detection item on which to focus, discovered as the key of the associated selected item in the
SparseArray, which is obtained from the detections'Detector.Detections.getDetectedItems()method.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-06-17 UTC.