Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete the unused BlazePose z property #218

Merged
merged 12 commits into from
Oct 19, 2024
Merged
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