-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
36 lines (28 loc) · 791 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// console.log(handTrack);
const video = document.getElementById("myvideo");
const canvas = document.getElementById("mycanvas");
let model;
const options = {
// flipHorizonal: false,
maxNumBoxes: 3,
scoreThreshold: 0.7,
}
let context = canvas.getContext("2d");
handTrack.load(options).then(function(modelData){
model = modelData;
console.log(model);
handTrack.startVideo(video).then(function(status){
if(status) {
console.log(status);
startDetection();
} else {
console.log("failed");
}
})
})
function startDetection() {
model.detect(video).then((predictions) => {
model.renderPredictions(predictions, canvas, context, video);
requestAnimationFrame(startDetection);
});
}