Skip to content

Instantly share code, notes, and snippets.

@risenW
Last active June 25, 2020 06:56
Show Gist options
  • Save risenW/09f17e2a048a1e5e63766ceb32b76c1e to your computer and use it in GitHub Desktop.
Save risenW/09f17e2a048a1e5e63766ceb32b76c1e to your computer and use it in GitHub Desktop.
let model;
let webcam
let webcamElement = document.getElementById("webcam")
let capturing = false
async function main() {
// Load the MediaPipe facemesh model.
model = await facemesh.load();
console.log("Model loaded")
webcam = await tf.data.webcam(webcamElement);
const imgtemp = await webcam.capture();
imgtemp.dispose()
document.getElementById("capture").addEventListener("click", function () {
capture()
})
document.getElementById("stop").addEventListener("click", function () {
capturing = false
})
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment