LargestFaceFocusingProcessor

public class LargestFaceFocusingProcessor extends FocusingProcessor<Face>

Face processor that focuses on tracking a single "prominent face", in conjunction with the associated FaceDetector. A prominent face is defined as a face which was initially the largest, most central face when tracking began. This face will continue to be tracked as the prominent face for as long as it is visible, even when it is not the largest face.

When the current prominent face is no longer present, another face will be selected as the new prominent face.

If you need to detect multiple faces in addition to the prominent face, you should use MultiProcessor instead of this class.

As an optimization, once the prominent face has been identified, the associated detector is instructed to track only that face. This makes face tracking faster.

For example, the code below creates and starts a pipeline that continuously receives preview frames from a camera source for the front facing camera, runs detection on the frames, manages tracking of the most prominent face, and delivers continuous update notifications over time to a developer-defined "FaceTracker" instance.

detector.setProcessor(
   new LargestFaceFocusingProcessor.Builder(detector, new FaceTracker())
     .build());

 CameraSource cameraSource = new CameraSource.Builder(context, detector)
   .setFacing(CameraSource.CAMERA_FACING_FRONT)
   .setRequestedPreviewSize(320, 240)
   .build()
   .start();
 
Where "detector" is a FaceDetector instance and "FaceTracker" is a Tracker callback for receiving notifications on the detected prominent face.

Nested Class Summary

class LargestFaceFocusingProcessor.Builder Builder for creating a LargestFaceFocusingProcessor. 

Public Constructor Summary

LargestFaceFocusingProcessor(Detector<Face> detector, Tracker<Face> tracker)

Inherited Method Summary

Public Constructors

public LargestFaceFocusingProcessor (Detector<Face> detector, Tracker<Face> tracker)