Skip to content

Instantly share code, notes, and snippets.

@AlexeyGy
Last active December 6, 2020 11:55
Show Gist options
  • Save AlexeyGy/8c58c581f9d8375c24dcde6d492f5760 to your computer and use it in GitHub Desktop.
Save AlexeyGy/8c58c581f9d8375c24dcde6d492f5760 to your computer and use it in GitHub Desktop.
smaller version of index-html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>webcam</title>
</head>
<body>
<script src="webcam.js"></script>
<div>
<form action="./images">
<input type="submit" value="Open snapshots" />
</form>
<canvas
id="drawings"
style="z-index: 100; position: absolute"
width="640px"
height="480px"
></canvas>
<div id="my_camera" style="width: 640px; height: 480px"></div>
</div>
<script language="JavaScript">
Webcam.set("constraints", { facingMode: "environment" }); // use the rear camera (called environment)
Webcam.attach("#my_camera"); // get webcam feed https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit/topic/803928
setTimeout(main, 5000); // sleep 5s so the webcam has some time to attach
function main() {
var ctx = document.getElementById("drawings").getContext("2d");
setInterval(function () {
take_snapshot();
}, 500); // every half second
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment