MultiProcessor

public class MultiProcessor extends Object
implements Processor<T>

Detection processor which distributes the items of a detection result among individual trackers. This enables detection result processing code to be defined at the individual item level, avoiding the need for boilerplate code for iterating over and managing groups of items.

When a new item is detected, a supplied MultiProcessor.Factory is used to create a Tracker instance to receive notifications on that item. This instance will be notified as the item changes, and eventually when the item is gone. The tracker may accumulate whatever state is appropriate over the life cycle of the item. For example, for gesture detection a face tracker may keep a record over time of recent landmark positions used in detecting a gesture such as blinking or a head nod.

For example, the code below creates and starts a pipeline that continuously receives preview frames from a camera source, runs detection on the frames, and uses a multiprocessor to continuously deliver notifications over multiple frames to tracker instances (a different tracker instance is created and managed for each distinct detected item).

detector.setProcessor(
   new MultiProcessor.Builder(new MyTrackerFactory()).build());

 CameraSource cameraSource = new CameraSource.Builder(context, detector)
   .build()
   .start();
 
Where "MyTrackerFactory" is an implementation of MultiProcessor.Factory for creating a Tracker instance for each distinct detected item.

Nested Class Summary

class MultiProcessor.Builder<T> Builder for creating a multiprocessor instance. 
interface MultiProcessor.Factory<T> Factory for creating new tracker instances. 

Public Method Summary

void
release()
Frees the resources associated with this detection processor.

Inherited Method Summary

Public Methods

public void release ()

Frees the resources associated with this detection processor.