java.lang.Object | ||
↳ | com.google.android.gms.vision.FocusingProcessor<com.google.android.gms.vision.face.Face> | |
↳ | com.google.android.gms.vision.face.LargestFaceFocusingProcessor |
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 Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
LargestFaceFocusingProcessor.Builder | Builder for creating a LargestFaceFocusingProcessor. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Parameters | |
---|---|
detector |
Detector
|
tracker |
Tracker
|