xxxxxxxxxx
53
//forked from Golan Levin https://openprocessing.org/sketch/1845926
// Note: this downloads very large models the first time it's run.
let myTracker;
let bComputeHands = true;
// Named points on hands.
// Don't delete or change these variable names.
let fingerIndexPt1,
fingerMiddlePt1,
fingerRingPt1,
fingerPinkyPt1,
thumbPt1,
palmPt1;
let fingerIndexPt2,
fingerMiddlePt2,
fingerRingPt2,
fingerPinkyPt2,
thumbPt2,
palmPt2;
//------------------------------------------
function setup() {
// The canvas should match aspect ratio of your camera:
createCanvas(640, 480);
myTracker = new HandsAndFaceWrapper(
bComputeFace,
bComputeHands,
bComputeBody
);
}
//------------------------------------------
function draw() {
background(255);
myTracker.update();
myTracker.drawVideoBackground(true);
//hand 1
if (bComputeHands && myTracker.getDoesHand1Exist()) {
noStroke();
fill("blue");
circle(fingerIndexPt1.x, fingerIndexPt1.y, 10);
}
//hand 2
if (bComputeHands && myTracker.getDoesHand2Exist()) {
noStroke();
fill("green");
circle(fingerIndexPt2.x, fingerIndexPt2.y, 10);
}
}