Skip to content

Commit

Permalink
add getConnections method and deprecate getSkeleton for bodyPose (
Browse files Browse the repository at this point in the history
#227)

* add getConnections method

* rename example

* remove deprecation comment
  • Loading branch information
ziyuan-linn authored Nov 1, 2024
1 parent 308b786 commit 5caa7a2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function setup() {

// Start detecting poses in the webcam video
bodyPose.detectStart(video, gotPoses);
// Get the skeleton connection information
connections = bodyPose.getSkeleton();
// Get the skeletal connection information
connections = bodyPose.getConnections();
}

function draw() {
Expand Down
14 changes: 12 additions & 2 deletions src/BodyPose/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ class BodyPose {
}

/**
* Returns the skeleton connections pairs for the model.
* Returns the skeletal connections pairs for the model.
* @returns {number[][]} an array of pairs of indices containing the connected keypoints.
* @public
*/
getSkeleton() {
getConnections() {
if (this.modelName === "BlazePose") {
return poseDetection.util.getAdjacentPairs(
poseDetection.SupportedModels.BlazePose
Expand All @@ -528,6 +528,16 @@ class BodyPose {
);
}
}

/**
* Returns the skeletal connections pairs for the model.
* An alias for `getConnections`.
* @returns {number[][]} an array of pairs of indices containing the connected keypoints.
* @public
*/
getSkeleton() {
return this.getConnections();
}
}

/**
Expand Down

0 comments on commit 5caa7a2

Please sign in to comment.