PoseDetector

  • PoseDetector is a client used to find Pose in an image.

  • A PoseDetector instance is created using PoseDetection.getClient(PoseDetectorOptionsBase).

  • Pose detection is performed by creating an InputImage and then calling the process() method on the PoseDetector.

  • The close() method is used to release the detector's resources.

  • The getInitTask() method returns a task for tracking the detector's initialization.

public interface PoseDetector extends Detector<Pose>

A PoseDetection client for finding Pose in a supplied image.

A PoseDetector is created via PoseDetection.getClient(PoseDetectorOptionsBase). For example:

PoseDetector poseDetector = PoseDetection.getClient(options);
 
To perform pose detection in an image, you first need to create an instance of InputImage from a Bitmap, ByteBuffer, Image etc. See InputImage documentation for more details. For example, the code below creates a InputImage from a Bitmap.
InputImage image = InputImage.fromBitmap(bitmap, rotationDegrees);
 
Then the code below can detect Pose in the supplied InputImage.
Task<Pose> task = poseDetector.process(image);
 task.addOnSuccessListener(...).addOnFailureListener(...);
 

Public Method Summary

abstract void
close()
Closes the detector and releases its resources.
abstract Task<Void>
getInitTask()
Returns the task for initializing the PoseDetector.
abstract Task<Pose>
process(MlImage image)
Detects human pose from the supplied image.
abstract Task<Pose>
process(InputImage image)
Detects human pose from the supplied image.

Inherited Method Summary

Public Methods

public abstract void close ()

Closes the detector and releases its resources.

public abstract Task<Void> getInitTask ()

Returns the task for initializing the PoseDetector.

The initialization is triggered in the background when a PoseDetector instance is created. The first process(InputImage) or process(MlImage) call will wait for the initialization to be finished.

If you want to optimize the latency of the first process call for better user experience, you could call this method to track initialization progress and only make the process call when the detector is successfully initialized.

public abstract Task<Pose> process (MlImage image)

Detects human pose from the supplied image.

This is an experimental API in beta version.

Create an MlImage object using one of MlImage's builder methods. See MlImage documentation for more details.

Returns
  • a Task that asynchronously returns a detected Pose

public abstract Task<Pose> process (InputImage image)

Detects human pose from the supplied image.

Create an InputImage object using one of InputImage's factory methods. See InputImage documentation for more details.

Returns
  • a Task that asynchronously returns a detected Pose