PoseLandmarker class

Performs pose landmarks detection on images.

Signature:

  export 
  
 declare 
  
 class 
  
 PoseLandmarker 
  
 extends 
  
 VisionTaskRunner 
  
 

Extends: VisionTaskRunner

Properties

Property Modifiers Type Description
static Connection[] An array containing the pairs of pose landmark indices to be rendered with connections.

Methods

Method Modifiers Description
static Initializes the Wasm runtime and creates a new PoseLandmarker based on the provided model asset buffer.
static Initializes the Wasm runtime and creates a new PoseLandmarker based on the path to the model asset.
static Initializes the Wasm runtime and creates a new PoseLandmarker from the provided options.
Performs pose detection on the provided single image and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode image .
Performs pose detection on the provided single image and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode image .
Performs pose detection on the provided single image and waits synchronously for the response. This method creates a copy of the resulting masks and should not be used in high-throughput applications. Only use this method when the PoseLandmarker is created with running mode image .
Performs pose detection on the provided single image and waits synchronously for the response. This method creates a copy of the resulting masks and should not be used in high-throughput applications. Only use this method when the PoseLandmarker is created with running mode image .
Performs pose detection on the provided video frame and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode video .
Performs pose detection on the provided video frame and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode video .
Performs pose detection on the provided video frame and returns the result. This method creates a copy of the resulting masks and should not be used in high-throughput applications. Only use this method when the PoseLandmarker is created with running mode video .
Performs pose detection on the provided video frame and returns the result. This method creates a copy of the resulting masks and should not be used in high-throughput applications. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode video .
Sets new options for this PoseLandmarker .Calling setOptions() with a subset of options only affects those options. You can reset an option back to its default value by explicitly setting it to undefined .

PoseLandmarker.POSE_CONNECTIONS

An array containing the pairs of pose landmark indices to be rendered with connections.

Signature:

  static 
  
 POSE_CONNECTIONS 
 : 
  
 Connection 
 []; 
 

PoseLandmarker.createFromModelBuffer()

Initializes the Wasm runtime and creates a new PoseLandmarker based on the provided model asset buffer.

Signature:

  static 
  
 createFromModelBuffer 
 ( 
 wasmFileset 
 : 
  
 WasmFileset 
 , 
  
 modelAssetBuffer 
 : 
  
 Uint8Array 
 ) 
 : 
  
 Promise<PoseLandmarker> 
 ; 
 

Parameters

Parameter Type Description
wasmFileset
WasmFileset A configuration object that provides the location of the Wasm binary and its loader.
modelAssetBuffer
Uint8Array A binary representation of the model.

Returns:

Promise< PoseLandmarker >

PoseLandmarker.createFromModelPath()

Initializes the Wasm runtime and creates a new PoseLandmarker based on the path to the model asset.

Signature:

  static 
  
 createFromModelPath 
 ( 
 wasmFileset 
 : 
  
 WasmFileset 
 , 
  
 modelAssetPath 
 : 
  
 string 
 ) 
 : 
  
 Promise<PoseLandmarker> 
 ; 
 

Parameters

Parameter Type Description
wasmFileset
WasmFileset A configuration object that provides the location of the Wasm binary and its loader.
modelAssetPath
string The path to the model asset.

Returns:

Promise< PoseLandmarker >

PoseLandmarker.createFromOptions()

Initializes the Wasm runtime and creates a new PoseLandmarker from the provided options.

Signature:

  static 
  
 createFromOptions 
 ( 
 wasmFileset 
 : 
  
 WasmFileset 
 , 
  
 poseLandmarkerOptions 
 : 
  
 PoseLandmarkerOptions 
 ) 
 : 
  
 Promise<PoseLandmarker> 
 ; 
 

Parameters

Parameter Type Description
wasmFileset
WasmFileset A configuration object that provides the location of the Wasm binary and its loader.
poseLandmarkerOptions
PoseLandmarkerOptions The options for the PoseLandmarker. Note that either a path to the model asset or a model buffer needs to be provided (via baseOptions ).

Returns:

Promise< PoseLandmarker >

PoseLandmarker.detect()

Performs pose detection on the provided single image and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode image .

Signature:

  detect 
 ( 
 image 
 : 
  
 ImageSource 
 , 
  
 callback 
 : 
  
 PoseLandmarkerCallback 
 ) 
 : 
  
 void 
 ; 
 

Parameters

Parameter Type Description
image
ImageSource An image to process.
callback
PoseLandmarkerCallback The callback that is invoked with the result. The lifetime of the returned masks is only guaranteed for the duration of the callback.

Returns:

void

PoseLandmarker.detect()

Performs pose detection on the provided single image and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode image .

Signature:

  detect 
 ( 
 image 
 : 
  
 ImageSource 
 , 
  
 imageProcessingOptions 
 : 
  
 ImageProcessingOptions 
 , 
  
 callback 
 : 
  
 PoseLandmarkerCallback 
 ) 
 : 
  
 void 
 ; 
 

Parameters

Parameter Type Description
image
ImageSource An image to process.
imageProcessingOptions
ImageProcessingOptions the ImageProcessingOptions specifying how to process the input image before running inference.
callback
PoseLandmarkerCallback The callback that is invoked with the result. The lifetime of the returned masks is only guaranteed for the duration of the callback.

Returns:

void

PoseLandmarker.detect()

Performs pose detection on the provided single image and waits synchronously for the response. This method creates a copy of the resulting masks and should not be used in high-throughput applications. Only use this method when the PoseLandmarker is created with running mode image .

Signature:

  detect 
 ( 
 image 
 : 
  
 ImageSource 
 ) 
 : 
  
 PoseLandmarkerResult 
 ; 
 

Parameters

Parameter Type Description
image
ImageSource An image to process. The landmarker result. Any masks are copied to avoid lifetime limits. The detected pose landmarks.

Returns:

PoseLandmarkerResult

PoseLandmarker.detect()

Performs pose detection on the provided single image and waits synchronously for the response. This method creates a copy of the resulting masks and should not be used in high-throughput applications. Only use this method when the PoseLandmarker is created with running mode image .

Signature:

  detect 
 ( 
 image 
 : 
  
 ImageSource 
 , 
  
 imageProcessingOptions 
 : 
  
 ImageProcessingOptions 
 ) 
 : 
  
 PoseLandmarkerResult 
 ; 
 

Parameters

Parameter Type Description
image
ImageSource An image to process. The landmarker result. Any masks are copied to avoid lifetime limits. The detected pose landmarks.
imageProcessingOptions
ImageProcessingOptions

Returns:

PoseLandmarkerResult

PoseLandmarker.detectForVideo()

Performs pose detection on the provided video frame and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode video .

Signature:

  detectForVideo 
 ( 
 videoFrame 
 : 
  
 ImageSource 
 , 
  
 timestamp 
 : 
  
 number 
 , 
  
 callback 
 : 
  
 PoseLandmarkerCallback 
 ) 
 : 
  
 void 
 ; 
 

Parameters

Parameter Type Description
videoFrame
ImageSource A video frame to process.
timestamp
number The timestamp of the current frame, in ms.
callback
PoseLandmarkerCallback The callback that is invoked with the result. The lifetime of the returned masks is only guaranteed for the duration of the callback.

Returns:

void

PoseLandmarker.detectForVideo()

Performs pose detection on the provided video frame and invokes the callback with the response. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode video .

Signature:

  detectForVideo 
 ( 
 videoFrame 
 : 
  
 ImageSource 
 , 
  
 timestamp 
 : 
  
 number 
 , 
  
 imageProcessingOptions 
 : 
  
 ImageProcessingOptions 
 , 
  
 callback 
 : 
  
 PoseLandmarkerCallback 
 ) 
 : 
  
 void 
 ; 
 

Parameters

Parameter Type Description
videoFrame
ImageSource A video frame to process.
timestamp
number The timestamp of the current frame, in ms.
imageProcessingOptions
ImageProcessingOptions the ImageProcessingOptions specifying how to process the input image before running inference.
callback
PoseLandmarkerCallback The callback that is invoked with the result. The lifetime of the returned masks is only guaranteed for the duration of the callback.

Returns:

void

PoseLandmarker.detectForVideo()

Performs pose detection on the provided video frame and returns the result. This method creates a copy of the resulting masks and should not be used in high-throughput applications. Only use this method when the PoseLandmarker is created with running mode video .

Signature:

  detectForVideo 
 ( 
 videoFrame 
 : 
  
 ImageSource 
 , 
  
 timestamp 
 : 
  
 number 
 ) 
 : 
  
 PoseLandmarkerResult 
 ; 
 

Parameters

Parameter Type Description
videoFrame
ImageSource A video frame to process.
timestamp
number The timestamp of the current frame, in ms. The landmarker result. Any masks are copied to extend the lifetime of the returned data.

Returns:

PoseLandmarkerResult

PoseLandmarker.detectForVideo()

Performs pose detection on the provided video frame and returns the result. This method creates a copy of the resulting masks and should not be used in high-throughput applications. The method returns synchronously once the callback returns. Only use this method when the PoseLandmarker is created with running mode video .

Signature:

  detectForVideo 
 ( 
 videoFrame 
 : 
  
 ImageSource 
 , 
  
 timestamp 
 : 
  
 number 
 , 
  
 imageProcessingOptions 
 : 
  
 ImageProcessingOptions 
 ) 
 : 
  
 PoseLandmarkerResult 
 ; 
 

Parameters

Parameter Type Description
videoFrame
ImageSource A video frame to process.
timestamp
number The timestamp of the current frame, in ms.
imageProcessingOptions
ImageProcessingOptions the ImageProcessingOptions specifying how to process the input image before running inference. The landmarker result. Any masks are copied to extend the lifetime of the returned data.

Returns:

PoseLandmarkerResult

PoseLandmarker.setOptions()

Sets new options for this PoseLandmarker .

Calling setOptions() with a subset of options only affects those options. You can reset an option back to its default value by explicitly setting it to undefined .

Signature:

  setOptions 
 ( 
 options 
 : 
  
 PoseLandmarkerOptions 
 ) 
 : 
  
 Promise<void> 
 ; 
 

Parameters

Parameter Type Description
options
PoseLandmarkerOptions The options for the pose landmarker.

Returns:

Promise<void>

Design a Mobile Site
View Site in Mobile | Classic
Share by: