ObjectDetection

public class ObjectDetection extends Object

Entry point to get an ObjectDetector for finding DetectedObjects in a supplied image.

An ObjectDetector is created via getClient(ObjectDetectorOptionsBase).

Example:

 ObjectDetector objectDetector = ObjectDetection.getClient(options); 

To perform object detection in an image, you first need to create an instance of InputImage from a Bitmap, ByteBuffer, etc. See InputImage documentation for more details. For example, the code below creates an InputImage from a Bitmap.

 InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees); 

Then the code below can detect objects in the supplied InputImage.

 Task<List<DetectedObject>> task = objectDetector.process(image);
 task.addOnSuccessListener(...).addOnFailureListener(...); 

Public Method Summary

static ObjectDetector
getClient(ObjectDetectorOptionsBase options)
Gets a new instance of ObjectDetector that can detect objects in a supplied image with the given options.

Inherited Method Summary

Public Methods

public static ObjectDetector getClient (ObjectDetectorOptionsBase options)

Gets a new instance of ObjectDetector that can detect objects in a supplied image with the given options.

To release the resources associated with an ObjectDetector, you need to ensure that ObjectDetector.close() is called on the resulting ObjectDetector instance once it will no longer be used.

Parameters
options the options for the object detector. It should be one of the concrete options like ObjectDetectorOptions or CustomObjectDetectorOptions.