20220523_002_draw_dot_skeleton/sketch.js
// A function to draw the skeletons
A function to draw the skeletons
A function to draw the skeletons
function drawSkeleton() {
  for (let i = 0; i < poses.length; i++) {
    let skeleton = poses[i].skeleton;
    for (let j = 0; j < skeleton.length; j++) {
      if (skeleton[j][0].score > 0.0 && skeleton[j][1].score > 0.2) {
        let partA = skeleton[j][0];
        let partB = skeleton[j][1];
        stroke(255, 0, 0);
        strokeWeight(skeleton_size * scale_mean);
        line(
          partA.position.x * scale_width,
          partA.position.y * scale_height,
          partB.position.x * scale_width,
          partB.position.y * scale_height
        );
      }
    }
  }
}
function drawSkeleton ( ) { for ( let i = 0 ; i < poses . length ; i ++ ) { let skeleton = poses [ i ] . skeleton ; for ( let j = 0 ; j < skeleton . length ; j ++ ) { if ( skeleton [ j ] [ 0 ] . score > 0.0 && skeleton [ j ] [ 1 ] . score > 0.2 ) { let partA = skeleton [ j ] [ 0 ] ; let partB = skeleton [ j ] [ 1 ] ; stroke ( 255 , 0 , 0 ) ; strokeWeight ( skeleton_size * scale_mean ) ; line ( partA . position . x * scale_width , partA . position . y * scale_height , partB . position . x * scale_width , partB . position . y * scale_height ) ; } } } }
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