-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
25 lines (21 loc) · 790 Bytes
/
main.js
File metadata and controls
25 lines (21 loc) · 790 Bytes
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
window.onload = function(){
navigator.mediaDevices.getUserMedia({
video: true
})
.then(async (stream) => {
document.querySelector('video').srcObject = stream;
const model = await faceLandmarksDetection.load(
faceLandmarksDetection.SupportedPackages.mediapipeFacemesh);
console.log("Model Loaded");
const video = document.querySelector("video");
setInterval(async () => {
const faces = await model.estimateFaces({ input: video });
faces &&
console.log("Face Left Eye", faces[0].annotations.leftEyeIris);
console.log("Face Right Eye", faces[0].annotations.rightEyeIris);
}, 1000)
})
.catch((err) => {
console.log(err);
})
}