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> | |
abstract Task<Pose> |
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 (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.