MultiProcessor Stay organized with collections Save and categorize content based on your preferences.
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 suppliedMultiProcessor.Factory is used to create aTracker 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 ofMultiProcessor.Factoryfor creating aTracker instance foreach 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
| 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 Methods
public voidrelease()
Frees the resources associated with this detection processor.
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.