Skip to content

Commit

Permalink
Delete the unused BlazePose z property (#218)
Browse files Browse the repository at this point in the history
* switch runtime to tfjs

* remove z property and code style change

---------

Co-authored-by: ziyuan-linn <zl4140@nyu.edu>
  • Loading branch information
shiffman and ziyuan-linn authored Oct 19, 2024
1 parent fcf5450 commit 630da82
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/BodyPose/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ class BodyPose {
addKeypoints(poses) {
poses.forEach((pose) => {
pose.keypoints.forEach((keypoint) => {
// Remove the z property that is not documented
if (keypoint.z) {
delete keypoint.z;
}

pose[keypoint.name] = {
x: keypoint.x,
y: keypoint.y,
Expand All @@ -475,14 +480,11 @@ class BodyPose {
// Add the 3d keypoints if in BlazePose mode
if (pose.keypoints3D) {
pose.keypoints3D.forEach((keypoint) => {
pose[keypoint.name] = {
...pose[keypoint.name],
keypoint3D: {
x: keypoint.x,
y: keypoint.y,
z: keypoint.z,
confidence: keypoint.confidence,
},
pose[keypoint.name].keypoint3D = {
x: keypoint.x,
y: keypoint.y,
z: keypoint.z,
confidence: keypoint.confidence,
};
});
}
Expand Down

0 comments on commit 630da82

Please sign in to comment.