Performs holistic landmarks detection on images.
This API expects a pre-trained holistic landmarks model asset bundle.
- Input image
MPImage
- The image that holistic landmarks detection runs on.
- Output
HolisticLandmarkerResult
- A HolisticLandmarkerResult containing holistic landmarks.
Nested Classes
class | HolisticLandmarker.HolisticLandmarkerOptions | Options for setting up an HolisticLandmarker . |
Public Methods
static HolisticLandmarker |
createFromBuffer(Context context, ByteBuffer modelAssetBuffer)
Creates a
HolisticLandmarker instance from a model asset bundle buffer and the default
HolisticLandmarker.HolisticLandmarkerOptions . |
static HolisticLandmarker |
createFromFile(Context context, String modelAssetPath)
Creates a
HolisticLandmarker instance from a model asset bundle path and the default
HolisticLandmarker.HolisticLandmarkerOptions . |
static HolisticLandmarker |
createFromFile(Context context, File modelAssetFile)
Creates a
HolisticLandmarker instance from a model asset bundle file and the default
HolisticLandmarker.HolisticLandmarkerOptions . |
static HolisticLandmarker |
createFromOptions(Context context, HolisticLandmarker.HolisticLandmarkerOptions landmarkerOptions)
Creates a
HolisticLandmarker instance from a HolisticLandmarker.HolisticLandmarkerOptions . |
HolisticLandmarkerResult | |
HolisticLandmarkerResult |
detect(MPImage image, ImageProcessingOptions imageProcessingOptions)
Performs holistic landmarks detection on the provided single image.
|
void |
detectAsync(MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Sends live image data to perform holistic landmarks detection, and the results will be
available via the
OutputHandler.ResultListener provided in the HolisticLandmarker.HolisticLandmarkerOptions . |
void |
detectAsync(MPImage image, long timestampMs)
Sends live image data to perform holistic landmarks detection with default image processing
options, i.e.
|
HolisticLandmarkerResult |
detectForVideo(MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Performs holistic landmarks detection on the provided video frame.
|
HolisticLandmarkerResult |
detectForVideo(MPImage image, long timestampMs)
Performs holistic landmarks detection on the provided video frame with default image processing
options, i.e.
|
Inherited Methods
Public Methods
public static HolisticLandmarker createFromBuffer (Context context, ByteBuffer modelAssetBuffer)
Creates a HolisticLandmarker
instance from a model asset bundle buffer and the default
HolisticLandmarker.HolisticLandmarkerOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
modelAssetBuffer | a direct ByteBuffer or a ERROR(/MappedByteBuffer) of the
detection model. |
Throws
if there is an error during HolisticLandmarker creation.
|
public static HolisticLandmarker createFromFile (Context context, String modelAssetPath)
Creates a HolisticLandmarker
instance from a model asset bundle path and the default
HolisticLandmarker.HolisticLandmarkerOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
modelAssetPath | path to the holistic landmarks model with metadata in the assets. |
Throws
if there is an error during HolisticLandmarker creation.
|
public static HolisticLandmarker createFromFile (Context context, File modelAssetFile)
Creates a HolisticLandmarker
instance from a model asset bundle file and the default
HolisticLandmarker.HolisticLandmarkerOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
modelAssetFile | the holistic landmarks model File instance. |
Throws
IOException | if an I/O error occurs when opening the tflite model file. |
---|---|
if there is an error during HolisticLandmarker creation.
|
public static HolisticLandmarker createFromOptions (Context context, HolisticLandmarker.HolisticLandmarkerOptions landmarkerOptions)
Creates a HolisticLandmarker
instance from a HolisticLandmarker.HolisticLandmarkerOptions
.
Parameters
context | an Android ERROR(/Context) . |
---|---|
landmarkerOptions | a HolisticLandmarker.HolisticLandmarkerOptions instance. |
Throws
if there is an error during HolisticLandmarker creation.
|
public HolisticLandmarkerResult detect (MPImage image)
Performs holistic landmarks detection on the provided single image with default image
processing options, i.e. without any rotation applied. Only use this method when the HolisticLandmarker
is created with ERROR(/RunningMode.IMAGE)
.
HolisticLandmarker
supports the following color space types:
Parameters
image | a MediaPipe MPImage object for processing. |
---|
Throws
if there is an internal error. |
public HolisticLandmarkerResult detect (MPImage image, ImageProcessingOptions imageProcessingOptions)
Performs holistic landmarks detection on the provided single image. Only use this method when
the HolisticLandmarker
is created with ERROR(/RunningMode.IMAGE)
.
HolisticLandmarker
supports the following color space types:
Parameters
image | a MediaPipe MPImage object for processing. |
---|---|
imageProcessingOptions | the ImageProcessingOptions specifying how to process the
input image before running inference. Note that region-of-interest is not supported
by this task: specifying ImageProcessingOptions.regionOfInterest() will result in
this method throwing an IllegalArgumentException. |
Throws
IllegalArgumentException | if the ImageProcessingOptions specify a
region-of-interest. |
---|---|
if there is an internal error. |
public void detectAsync (MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Sends live image data to perform holistic landmarks detection, and the results will be
available via the OutputHandler.ResultListener
provided in the HolisticLandmarker.HolisticLandmarkerOptions
.
Only use this method when the HolisticLandmarker
is created with ERROR(/RunningMode.LIVE_STREAM)
.
It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent to the holistic landmarker. The input timestamps must be monotonically increasing.
HolisticLandmarker
supports the following color space types:
Parameters
image | a MediaPipe MPImage object for processing. |
---|---|
imageProcessingOptions | the ImageProcessingOptions specifying how to process the
input image before running inference. Note that region-of-interest is not supported
by this task: specifying ImageProcessingOptions.regionOfInterest() will result in
this method throwing an IllegalArgumentException. |
timestampMs | the input timestamp (in milliseconds). |
Throws
IllegalArgumentException | if the ImageProcessingOptions specify a
region-of-interest. |
---|---|
if there is an internal error. |
public void detectAsync (MPImage image, long timestampMs)
Sends live image data to perform holistic landmarks detection with default image processing
options, i.e. without any rotation applied, and the results will be available via the OutputHandler.ResultListener
provided in the HolisticLandmarker.HolisticLandmarkerOptions
. Only use this method when
the HolisticLandmarker
is created with ERROR(/RunningMode.LIVE_STREAM)
.
It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent to the holistic landmarker. The input timestamps must be monotonically increasing.
HolisticLandmarker
supports the following color space types:
Parameters
image | a MediaPipe MPImage object for processing. |
---|---|
timestampMs | the input timestamp (in milliseconds). |
Throws
if there is an internal error. |
public HolisticLandmarkerResult detectForVideo (MPImage image, ImageProcessingOptions imageProcessingOptions, long timestampMs)
Performs holistic landmarks detection on the provided video frame. Only use this method when
the HolisticLandmarker
is created with ERROR(/RunningMode.VIDEO)
.
It's required to provide the video frame"s timestamp (in milliseconds). The input timestamps must be monotonically increasing.
HolisticLandmarker
supports the following color space types:
Parameters
image | a MediaPipe MPImage object for processing. |
---|---|
imageProcessingOptions | the ImageProcessingOptions specifying how to process the
input image before running inference. Note that region-of-interest is not supported
by this task: specifying ImageProcessingOptions.regionOfInterest() will result in
this method throwing an IllegalArgumentException. |
timestampMs | the input timestamp (in milliseconds). |
Throws
IllegalArgumentException | if the ImageProcessingOptions specify a
region-of-interest. |
---|---|
if there is an internal error. |
public HolisticLandmarkerResult detectForVideo (MPImage image, long timestampMs)
Performs holistic landmarks detection on the provided video frame with default image processing
options, i.e. without any rotation applied. Only use this method when the HolisticLandmarker
is created with ERROR(/RunningMode.VIDEO)
.
It's required to provide the video frame"s timestamp (in milliseconds). The input timestamps must be monotonically increasing.
HolisticLandmarker
supports the following color space types:
Parameters
image | a MediaPipe MPImage object for processing. |
---|---|
timestampMs | the input timestamp (in milliseconds). |
Throws
if there is an internal error. |