browser_client/examples/example5_posenet_curves_combine/sketch.js
// Get rid of any keypoints that are not being used
Get rid of any keypoints that are not being used
Get rid of any keypoints that are not being used
function removeUnusedKeypoints(pose) {
  let cleanPose = [];
  for (let i = 0; i < pose.length; i++) {
    if (pose[i].position.x !== null) {
      cleanPose.push({
        position: {
          x: pose[i].position.x,
          y: pose[i].position.y,
        },
      });
    }
  }
  return cleanPose;
}
function removeUnusedKeypoints ( pose ) { let cleanPose = [ ] ; for ( let i = 0 ; i < pose . length ; i ++ ) { if ( pose [ i ] . position . x !== null ) { cleanPose . push ( { position : { x : pose [ i ] . position . x , y : pose [ i ] . position . y , } , } ) ; } } return cleanPose ; }
Get rid of any keypoints that are not being used
Get rid of any keypoints that are not being used
// Create an array to hold the used keypoints // Iterate through each keypoint // If the position exists for the keypoint // Add the position to the keypoint in the clean array // Return the clean array