ai_creativity_design/final_project/main_test.js
// A function to draw ellipses over the detected keypoints
A function to draw ellipses over the detected keypoints
A function to draw ellipses over the detected keypoints
function drawKeypoints() {
    for (let i = 0; i < poses.length; i++) {
      let pose = poses[i].pose;
      for (let j = 2; j < pose.keypoints.length; j=j+10) {
        for (let k = 3; k < pose.keypoints.length; k=k+10){
          for (let l = 4; l < pose.keypoints.length; l=l+10){
            for (let m = 5; m < pose.keypoints.length; m=m+10){
              let keypoint = pose.keypoints[j];
              let keypoint2 = pose.keypoints[k];
              let keypoint3 = pose.keypoints[l];
              let keypoint4 = pose.keypoints[m];
              if (keypoint.score > 0.2) {
          strokeWeight(1);
          stroke(255,0,0);
          beginShape();
        curveVertex(keypoint.position.x, keypoint.position.y,10,20);
          curveVertex(keypoint2.position.x, keypoint2.position.y);
          curveVertex(keypoint3.position.x, keypoint3.position.y);
          curveVertex(keypoint4.position.x, keypoint4.position.y);
          endShape();
        }
      }
    }
    }
  }
  }
  for (var i = 0; i < poses.length; i++) {
    let pose = poses[i].pose;
    for (var j = 0; j < pose.keypoints.length; j++) {
      console.log(noseArray);
      console.log(leftWristArray)
      strokeWeight(1);
      makeVectors("nose", pose, j, noseArray);
      makeVectors("leftWrist", pose, j, leftWristArray);
      makeVectors("rightAnkle", pose, j, rightAnkleArray);
      stroke(255);
      makeConnections(leftWristArray);
      makeConnections(noseArray);
      makeConnections(rightAnkleArray);
    }
  }
}
function drawKeypoints ( ) { for ( let i = 0 ; i < poses . length ; i ++ ) { let pose = poses [ i ] . pose ; for ( let j = 2 ; j < pose . keypoints . length ; j = j + 10 ) { for ( let k = 3 ; k < pose . keypoints . length ; k = k + 10 ) { for ( let l = 4 ; l < pose . keypoints . length ; l = l + 10 ) { for ( let m = 5 ; m < pose . keypoints . length ; m = m + 10 ) { let keypoint = pose . keypoints [ j ] ; let keypoint2 = pose . keypoints [ k ] ; let keypoint3 = pose . keypoints [ l ] ; let keypoint4 = pose . keypoints [ m ] ; if ( keypoint . score > 0.2 ) { strokeWeight ( 1 ) ; stroke ( 255 , 0 , 0 ) ; beginShape ( ) ; curveVertex ( keypoint . position . x , keypoint . position . y , 10 , 20 ) ; curveVertex ( keypoint2 . position . x , keypoint2 . position . y ) ; curveVertex ( keypoint3 . position . x , keypoint3 . position . y ) ; curveVertex ( keypoint4 . position . x , keypoint4 . position . y ) ; endShape ( ) ; } } } } } } for ( var i = 0 ; i < poses . length ; i ++ ) { let pose = poses [ i ] . pose ; for ( var j = 0 ; j < pose . keypoints . length ; j ++ ) { console . log ( noseArray ) ; console . log ( leftWristArray ) strokeWeight ( 1 ) ; makeVectors ( "nose" , pose , j , noseArray ) ; makeVectors ( "leftWrist" , pose , j , leftWristArray ) ; makeVectors ( "rightAnkle" , pose , j , rightAnkleArray ) ; stroke ( 255 ) ; makeConnections ( leftWristArray ) ; makeConnections ( noseArray ) ; makeConnections ( rightAnkleArray ) ; } } }
A function to draw ellipses over the detected keypoints
A function to draw ellipses over the detected keypoints