browser_client/examples/example3_posenet_skeleton_no_mirror/sketch.js
// A function to draw the skeletons
A function to draw the skeletons
A function to draw the skeletons
function drawSkeleton(pose, clr, offset) {
  const skeleton = pose.skeleton;
  for (let j = 0; j < skeleton.length; j++) {
    const partA = skeleton[j][0];
    const partB = skeleton[j][1];
    if (
      partA.score > scoreThreshold &&
      partB.score > scoreThreshold
    ) {
      stroke(clr);
      line(
        partA.position.x + offset,
        partA.position.y,
        partB.position.x + offset,
        partB.position.y,
      );
    }
  }
}
function drawSkeleton ( pose , clr , offset ) { const skeleton = pose . skeleton ; for ( let j = 0 ; j < skeleton . length ; j ++ ) { const partA = skeleton [ j ] [ 0 ] ; const partB = skeleton [ j ] [ 1 ] ; if ( partA . score > scoreThreshold && partB . score > scoreThreshold ) { stroke ( clr ) ; line ( partA . position . x + offset , partA . position . y , partB . position . x + offset , partB . position . y , ) ; } } }
A function to draw the skeletons
A function to draw the skeletons
// Loop through all the skeletons detected // For every skeleton, loop through all body connections // Get the ends "joints" for each bone // If the score is high enough // Draw a line to represent the bone