-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
69 lines (59 loc) · 1.78 KB
/
index.html
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>WebcamJS Test Page</title>
<style type="text/css">
body { font-family: Helvetica, sans-serif; }
h2, h3 { margin-top:0; }
form { margin-top: 15px; }
form > input { margin-right: 15px; }
#results { float:right; margin:20px; padding:20px; border:1px solid; background:#ccc; }
</style>
</head>
<body>
<div id="dec">result
<!-- <img id="pic" src="../code2.jpeg"> -->
</div>
<form>
<input type=button value="Start capturing" onClick="take_snapshot()">
<!-- <input type=button value="Convert" onClick="convert()"> -->
</form>
<div id="my_camera" style="width:1280px; height:720px;"></div>
<div id="results">Your captured image will appear here...
<!-- <img id="pic" src="../code2.jpeg"> -->
</div>
<!-- First, include the Webcam.js JavaScript Library -->
<script type="text/javascript" src="webcam.js"></script>
<script type="text/javascript" src="decoder.js"></script>
<!-- Configure a few settings and attach camera -->
<script language="JavaScript">
Webcam.set({
image_format: 'jpeg',
jpeg_quality: 100
});
Webcam.attach( '#my_camera' );
</script>
<!-- A button for taking snaps -->
<!-- Code to handle taking the snapshot and displaying it locally -->
<script language="JavaScript">
function take_snapshot() {
// take snapshot and get image data
var data_uri = Webcam.snap();
// display results in page
document.getElementById('results').innerHTML =
'<h2>Here is your image:</h2>' +
'<img id="pic" src="'+data_uri+'"/>';
console.log(Decode('pic'))
}
function start(){
setInterval(function(){
take_snapshot();
}, 1000)
}
function convert(){
console.log(Decode('pic'))
}
</script>
</body>
</html>