forked from achiever93/Aaina-AR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
185 lines (139 loc) · 5.52 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!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:10px; padding:20px; border:1px solid; background:#ccc; }
</style>
<link rel="stylesheet" type="text/css" href="assets/css/styles.css" />
<link rel="stylesheet" type="text/css" href="assets/fancybox/jquery.fancybox-1.3.4.css" />
</head>
<body>
<div id="results">Your captured image will appear here..</div>
<div id="topBar">
<h1>Tryon Jewelery</h1>
<!-- <h2><a href="http://">« Go back</a></h2>-->
</div>
<div id="photos">
<canvas id="c" width="640" height="480" style="border:2px solid #d3d3d3;"></canvas>
</div>
<div id ="upload">
<input type="image" src="arrow.png" width="200px"/>
<input type="file" id="my_file" style="display: none;" />
</div>
<div id="camera">
<span class="tooltip"></span>
<span class="camTop"></span>
<div id="screen"></div>
<div id="buttons">
<div class="buttonPane">
<a id="shootButton" href="" class="blueButton">Shoot!</a>
</div>
<div class="buttonPane hidden">
<a id="cancelButton" href="" class="blueButton">Cancel</a> <a id="uploadButton" href="" class="greenButton">Upload!</a>
</div>
</div>
<span class="settings"></span>
</div>
<!-- <div id="my_camera"></div>-->
<!--
<script src="assets/fancybox/jquery.easing-1.3.pack.js"></script>
<script src="assets/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
-->
<!-- First, include the Webcam.js JavaScript Library -->
<script src="jquery.min.js"></script>
<script src="jquery-2.1.4.min.js"></script>
<script src="assets/fancybox/jquery.easing-1.3.pack.js"></script>
<script src="assets/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="webcamjs/webcam.js"></script>
<script src="fabric/dist/fabric.min.js"></script>
<script src="fabric/dist/fabric.require.js"></script>
<script src="scriptone.js"></script>
<!-- Configure a few settings and attach camera -->
<script language="JavaScript">
/*Webcam.set({
width: 500,
height: 375,
dest_width: 640,
dest_height: 480,
image_format: 'jpeg',
jpeg_quality: 90
});*/
</script>
<!-- A button for taking snaps
<form>
<input type="file" id="imgLoader">
<input type="button" value="Access Camera" onClick="setup(); $(this).hide().next().show();">
<input type="button" value="Take Snapshot" onClick="take_snapshot()" style="display:none">
</form>-->
<!-- Code to handle taking the snapshot and displaying it locally -->
<script language="JavaScript">
/*var canvas = new fabric.Canvas('c');
//code for upload
document.getElementById('imgLoader').onchange = function handleImage(e) {
canvas.clear().renderAll();
var reader = new FileReader();
reader.onload = function (event) { console.log('fdsf');
var imgObj = new Image();
imgObj.src = event.target.result;
imgObj.onload = function () {
// start fabricJS stuff
var image = new fabric.Image(imgObj);
image.set({
left: 25,
top: 25,
angle: 0,
padding: 10,
cornersize: 10
});
//image.scale(getRandomNum(0.1, 0.25)).setCoords();
canvas.setBackgroundImage(image);
fabric.Image.fromURL('necklace.png', function(oImg) {
// scale image down, and flip it, before adding it onto canvas
oImg.scale(0.5).setFlipX(true);
canvas.add(oImg);
});
// end fabricJS stuff
}
}
reader.readAsDataURL(e.target.files[0]);
}*/
//turns on the camera
function setup() {
//Webcam.attach( '#screen' );
}
//snaps and puts its on canvas
function take_snapshot() {
// var ctx=c.getContext("2d");
// var img=new Image();
// Webcam.snap( function(data_uri, canvas, context) {
// // copy image to my own canvas
// ctx.drawImage( img, 0, 0 );
// } );
//ctx.clearRect(0, 0, 800, 800);
// take snapshot and get image data
/*Webcam.snap( function(data_uri) {
//clear the canvas
canvas.clear().renderAll();
// display results in page
fabric.Image.fromURL(data_uri, function(wImg) {
// scale image down, and flip it, before adding it onto canvas
//oImg.scale(0.5).setFlipX(true);
canvas.setBackgroundImage(wImg);
});
//document.getElementById('results').innerHTML =
//'<h2>Here is your image:</h2>' +
//'<img src="'+data_uri+'"/>';
});
fabric.Image.fromURL('necklace.png', function(oImg) {
//scale image down, and flip it, before adding it onto canvas
canvas.add(oImg);}); */
}
</script>
</body>
</html>