xxxxxxxxxx
38
let capture, tracker;
function setup() {
capture = createCapture();
createCanvas(640, 480);
capture.size(640, 480);
capture.hide();
tracker = new clm.tracker();
tracker.init();
tracker.start(capture.elt);
}
function draw() {
image(capture, 0, 0, 640, 480);
let positions = tracker.getCurrentPosition();
if (positions.length > 0) {
fill("red");
noStroke();
ellipse(positions[62][0], positions[62][1], 50, 50);
}
}
function getSimplePos(tracker) {
let pos = {};
pos.found = false;
let current = tracker.getCurrentPosition();
if (current.length > 0) {
pos.found = true;
pos.eye_l = current[27];
pos.eye_r = current[32];
pos.mouth = current[60];
pos.nose = current[62];
}
return pos;
}