Hi, I have been trying to run movenet with p5js. I have managed to get the detector working and can log out the poses. However , I am trying to draw a skeleton on top of the connected circle for vizualization purposes. I have looked into posenet
as it has similar 17 keypoints. However, I noticed that some functions such as posenet.getAdjacentKeypoints
are not implemented in movenet. skeleton. My sample trial sketch (inspired by coding train is below).
The keypoints are following the COCO keypoint format. coco keypoint format
let detector;
let poses;
let video;
async function init() {
const detectorConfig = {
modelType: poseDetection.movenet.modelType.SINGLEPOSE_LIGHTNING,
};
detector = await poseDetection.createDetector(
poseDetection.SupportedModels.MoveNet,
detectorConfig
);
}
async function videoReady() {
console.log("video ready");
await getPoses();
}
async function setup() {
createCanvas(640, 480);
video = createCapture(VIDEO, videoReady);
video.hide();
await init();
//createButton('pose').mousePressed(getPoses)
}
async function getPoses() {
poses = await detector.estimatePoses(video.elt);
setTimeout(getPoses, 0);
}
function draw() {
background(220);
image(video, 0, 0);
if (poses && poses.length > 0) {
//console.log(poses[0].keypoints.length)
//console.log(poses[0].keypoints[0].x);
for (let kp of poses[0].keypoints) {
const { x, y, score } = kp;
console.log(kp);
if (score > 0.5) {
fill(255);
stroke(0);
strokeWeight(4);
circle(x, y, 16);
}
}
for (let i = 0; i < poses[0].keypoints.length ; i ++)
{
// Get adjacent keypoints (Start with nose and left_eye)
let x = poses[0].keypoints.length.nose
}
}
}
If i understand the line functions needs both the x1,x2
and y1,y2
co-ordinates to effectively join the points. I was wondering if anyone has managed to overlay the skeleton