PoseLandmarker

public final class PoseLandmarker

Performs pose landmarks detection on images.

This API expects a pre-trained pose landmarks model asset bundle. See .

  • Input image MPImage
    • The image that pose landmarks detection runs on.
  • Output PoseLandmarkerResult PoseLandmarkerResult
    • A PoseLandmarkerResult containing pose landmarks.

Nested Classes

class PoseLandmarker.PoseLandmarkerOptions Options for setting up an PoseLandmarker

Fields

public static final Set<Connection> POSE_LANDMARKS

Public Methods

static PoseLandmarker
createFromBuffer(Context context, ByteBuffer modelBuffer)
Creates a PoseLandmarker instance from a model buffer and the default PoseLandmarker.PoseLandmarkerOptions.
static PoseLandmarker
createFromFile(Context context, String modelPath)
Creates a PoseLandmarker instance from a model file and the default PoseLandmarker.PoseLandmarkerOptions.
static PoseLandmarker
createFromFile(Context context, File modelFile)
Creates a PoseLandmarker instance from a model file and the default PoseLandmarker.PoseLandmarkerOptions.
static PoseLandmarker
PoseLandmarkerResult
detect(MPImage image)
Performs pose landmarks detection on the provided single image with default image processing options, i.e.
PoseLandmarkerResult
detect(MPImage image, ImageProcessingOptions imageProcessingOptions)
Performs pose landmarks detection on the provided single image.
void
detectAsync(MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Sends live image data to perform pose landmarks detection, and the results will be available via the OutputHandler.ResultListener provided in the PoseLandmarker.PoseLandmarkerOptions.
void
detectAsync(MPImage image, long timestampMs)
Sends live image data to perform pose landmarks detection with default image processing options, i.e.
PoseLandmarkerResult
detectForVideo(MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Performs pose landmarks detection on the provided video frame.
PoseLandmarkerResult
detectForVideo(MPImage image, long timestampMs)
Performs pose landmarks detection on the provided video frame with default image processing options, i.e.

Inherited Methods

Fields

public static final Set<Connection> POSE_LANDMARKS

Public Methods

public static PoseLandmarker createFromBuffer (Context context, ByteBuffer modelBuffer)

Creates a PoseLandmarker instance from a model buffer and the default PoseLandmarker.PoseLandmarkerOptions.

Parameters
context an Android ERROR(/Context).
modelBuffer a direct ByteBuffer or a ERROR(/MappedByteBuffer) of the detection model.
Throws
if there is an error during PoseLandmarker creation.

public static PoseLandmarker createFromFile (Context context, String modelPath)

Creates a PoseLandmarker instance from a model file and the default PoseLandmarker.PoseLandmarkerOptions.

Parameters
context an Android ERROR(/Context).
modelPath path to the pose landmarks model with metadata in the assets.
Throws
if there is an error during PoseLandmarker creation.

public static PoseLandmarker createFromFile (Context context, File modelFile)

Creates a PoseLandmarker instance from a model file and the default PoseLandmarker.PoseLandmarkerOptions.

Parameters
context an Android ERROR(/Context).
modelFile the pose landmarks model File instance.
Throws
IOException if an I/O error occurs when opening the tflite model file.
if there is an error during PoseLandmarker creation.

public static PoseLandmarker createFromOptions (Context context, PoseLandmarker.PoseLandmarkerOptions landmarkerOptions)

Parameters
context an Android ERROR(/Context).
landmarkerOptions a PoseLandmarker.PoseLandmarkerOptions instance.
Throws
if there is an error during PoseLandmarker creation.

public PoseLandmarkerResult detect (MPImage image)

Performs pose landmarks detection on the provided single image with default image processing options, i.e. without any rotation applied. Only use this method when the PoseLandmarker is created with ERROR(/RunningMode.IMAGE). TODO update java doc for input image format.

PoseLandmarker supports the following color space types:

Parameters
image a MediaPipe