FocusingProcessor

TheMobile Vision API is deprecated and no longer maintained.It is now a part ofML Kit which includes all new on-device MLcapabilities. If you use Mobile Vision in your app today, follow themigration guide.
Also:"vision"
public abstract classFocusingProcessor extendsObject
implementsProcessor<T>

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

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

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
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 interfacecom.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

publicFocusingProcessor(Detector<T> detector,Tracker<T> tracker)

Also: "vision"

Creates a focusing processor.

Parameters
detectorassociated 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.
trackerinstance to receive notifications on the status of the focus item of interest.

Public Methods

public voidrelease()

Also:"vision"

Notifies the associated tracker that tracking has completed.

public abstract intselectFocus(Detections<T> detections)

Also: "vision"

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

Parameters
detectionsdetection results received from a detector
Returns

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.