Skip to content

Commit a7a8646

Browse files
authored
BlazePose named 3d keypoints (#215)
* remove 2d z value * add 3d values
1 parent 0e66eae commit a7a8646

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/BodyPose/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,22 @@ class BodyPose {
470470
y: keypoint.y,
471471
confidence: keypoint.confidence,
472472
};
473-
if (keypoint.z) pose[keypoint.name].z = keypoint.z;
474473
});
474+
475+
// Add the 3d keypoints if in BlazePose mode
476+
if (pose.keypoints3D) {
477+
pose.keypoints3D.forEach((keypoint) => {
478+
pose[keypoint.name] = {
479+
...pose[keypoint.name],
480+
keypoint3D: {
481+
x: keypoint.x,
482+
y: keypoint.y,
483+
z: keypoint.z,
484+
confidence: keypoint.confidence,
485+
},
486+
};
487+
});
488+
}
475489
});
476490
}
477491

0 commit comments

Comments
 (0)