Summary: Ctors | Methods | Inherited Methods | [Expand All]
public abstract class

# FocusingProcessor

extends Object
implements Processor<T>

java.lang.Object
↳ | com.google.android.gms.vision.FocusingProcessor<T>

Known Direct Subclasses LargestFaceFocusingProcessor
LargestFaceFocusingProcessor | Face processor that focuses on tracking a single "prominent face", in conjunction with the associated `FaceDetector`.

## Class Overview

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(com.google.android.gms.vision.Detector.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 `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.

## Summary

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

Public Methods
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.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface com.google.android.gms.vision.Detector.Processor
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

#### public FocusingProcessor (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 into `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 ()

Notifies the associated tracker that tracking has completed.

#### public abstract int selectFocus (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' `getDetectedItems()` method.