Google is committed to advancing racial equity for Black communities. See how.


public class FirebaseVisionObjectDetector 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 FirebaseVisionObjects in a supplied image.

A object detector is created via getOnDeviceObjectDetector(FirebaseVisionObjectDetectorOptions) or getOnDeviceObjectDetector(), if you wish to use the default options. For example, the code below creates an object detector with default options.

 FirebaseVisionObjectDetector objectDetector =
To perform object 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 ByteBuffer.
 FirebaseVisionImage image
    = FirebaseVisionImage.fromByteBuffer(byteBuffer, imageMetadata);
Then the code below can detect objects in the supplied FirebaseVisionImage.

 Task<List<FirebaseVisionObject>> task = objectDetector.processImage(image);

Public Method Summary

processImage(FirebaseVisionImage image)
Detects objects from supplied image.

Inherited Method Summary

Public Methods

public void close ()


public Task<List<FirebaseVisionObject>> processImage (FirebaseVisionImage image)

Detects objects from supplied image.

For best efficiency, create a FirebaseVisionImage object using following way:

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

Note that the width and height of the provided image cannot be less than 32.