FirebaseVisionFaceDetector

public class FirebaseVisionFaceDetector extends Object
implements Closeable Closeable

This class is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.

Detector for finding FirebaseVisionFaces in a supplied image.

A face detector is created via getVisionFaceDetector(FirebaseVisionFaceDetectorOptions) or getVisionFaceDetector(), if you wish to use the default options. For example, the code below creates a face detector with default options.

 FirebaseVisionFaceDetector faceDetector =
    FirebaseVision.getInstance().getVisionFaceDetector();
 
To perform face detection in an image, you first need to create an instance of FirebaseVisionImage from a Bitmap, ByteBuffer, etc. See FirebaseVisionImage documentation for more details. For example, the code below creates a FirebaseVisionImage from a Bitmap.
      FirebaseVisionImage image = FirebaseVisionImage.fromBitmap(bitmap);
Then the code below can detect faces in the supplied FirebaseVisionImage.

 Task<List<FirebaseVisionFace>> task = faceDetector.detectInImage(image);
 task.addOnSuccessListener(...).addOnFailureListener(...);
 

Public Method Summary

void
close()
Closes this FirebaseVisionFaceDetector and releases its model resources.
Task<List<FirebaseVisionFace>>
detectInImage(FirebaseVisionImage image)
Detects human faces from the supplied image.

Inherited Method Summary

Public Methods

public void close ()

Closes this FirebaseVisionFaceDetector and releases its model resources.

Throws
IOException

public Task<List<FirebaseVisionFace>> detectInImage (FirebaseVisionImage image)

Detects human faces from the supplied image.

For best efficiency, create a FirebaseVisionImage object using one of the following ways:

All other FirebaseVisionImage factory methods will work as well, but possibly slightly slower.

Note that the width of the provided image cannot be less than 32 if ALL_CONTOURS is specified.

Returns