-
Notifications
You must be signed in to change notification settings - Fork 1
/
SignUp.html
198 lines (166 loc) · 10.7 KB
/
SignUp.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
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html>
<head>
<title>ChezWam@Experiments - SignUp</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);html,body { height: 100%; font-family: 'Droid Sans Mono', sans-serif;}p,h1,h2,h3,h4 { font-family: 'Droid Sans Mono', sans-serif;}hr { border-color:#191919;}/* wrapper for page content to push down footer */.page-container { min-height: 100%; height: auto !important; height: 100%; /* negative indent footer by its height */ margin: 0 auto -120px; /* pad bottom by footer height */ padding: 0 0 70px;}/* set the fixed height of the footer here */#footer { height: 120px; background-color: #222222; border:0 solid #080808; border-top-width: 1px; margin-top:50px;}#footer > .container { padding: 20px;}body { padding-top: 51px; background: #1E1E1E; color: #f9f9f9;}a { color:#bcbcbc;}.text-center { padding-top: 20px;}#sidebar { height: 100%; padding-right: 0; padding-top: 20px;}#sidebar .affix { position:fixed; top:55; width:220px;}#sidebar .affix-bottom { position:fixed; top:55; width:220px;}#sidebar .nav { width: 95%;}#sidebar li { border:0 #1e1e1e solid; border-bottom-width:1px;}#sidebar li a { padding-left:1px;}#sidebar li a:hover { background-color:#222222; color:#ffffff;}/* collapsed sidebar styles */@media screen and (max-width: 767px) { .row-offcanvas { position: relative; -webkit-transition: all 0.25s ease-out; -moz-transition: all 0.25s ease-out; transition: all 0.25s ease-out; } .row-offcanvas-right .sidebar-offcanvas { right: -41.6%; } .row-offcanvas-left .sidebar-offcanvas { left: -41.6%; } .row-offcanvas-right.active { right: 41.6%; } .row-offcanvas-left.active { left: 41.6%; } .sidebar-offcanvas { position: absolute; top: 0; width: 41.6%; } #sidebar { background-color:#3b3b3b; padding-top:0; } #sidebar .nav>li { color: #ddd; background: linear-gradient(#3E3E3E, #383838); border-top: 1px solid #484848; border-bottom: 1px solid #2E2E2E; padding-left:10px; } #sidebar .nav>li:first-child { border-top:0; } #sidebar .nav>li>a { color: #ddd; } #sidebar .nav>li>a>img { max-width: 14px; } #sidebar .nav>li>a:hover, #sidebar .nav>li>a:focus { text-decoration: none; background: linear-gradient(#373737, #323232); color: #fff; } #sidebar .nav .caret { border-top-color: #fff; border-bottom-color: #fff; } #sidebar .nav a:hover .caret{ border-top-color: #fff; border-bottom-color: #fff; }}/* theme */.btn,.form-control,.alert,.progress,.panel,.list-group,.well,.list-group-item:first-child {border-radius:1px;box-shadow:0 0 0;}.btn {border-color:transparent;}.btn-default,.well { background-color:#cccccc; border-color:#c0c0c0;}.btn-primary,.label-primary,.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus,.btn.active,a.list-group-item.active, a.list-group-item.active:hover, a.list-group-item.active:focus { background-color:#0099CC; border-color:transparent;}.btn-info,.label-info,.progress-bar-info { background-color:#33b5e5;}.btn-success,.label-success,.progress-bar-success { background-color:#669900;}.btn-danger,.label-danger,.progress-bar-danger { background-color:#FF4444;}.btn-warning,.label-warning,.progress-bar-warning { background-color:#FFBB33; color:#444444;}.nav-tabs>li>a { border-radius:0;} h3,h4,h5,.panel { color:#555555;}.panel hr { border-color:#efefef;}
h2 {
font-size: 20px;
@media(min-width: @screen-desktop) {
font-size: 60px
}
h1 {
font-size: 40px;
@media(min-width: @screen-desktop) {
font-size: 50px
}
</style>
</head>
<body>
<script src="./js/utils.js"></script>
<script src="./js/numeric-1.2.6.min.js"></script>
<script src="./js/mosse.js"></script>
<script src="./js/left_eye_filter.js"></script>
<script src="./js/right_eye_filter.js"></script>
<script src="./js/nose_filter.js"></script>
<script src="./js/model_pca_20_svm.js"></script>
<script src="./js/clm.js"></script>
<script src="./js/ccv.js"></script>
<script src="./js/cascade.js"></script>
<script src="./js/svmfilter_webgl.js"></script>
<script src="./js/svmfilter_fft.js"></script>
<script src="./js/mossefilter.js"></script>
<script src="./js/Stats.js"></script>
<div id="content">
<div class="container">
<div class="col-xs-6 col-xs-offset-3 page-header " style="text-align: center; border: 1px solid #ccc;">
<h2>Login</h2>
<h2>Using your</h2>
<h1>FACE</h1>
<small>or sign up.</small>
</div>
<div class="row" >
<div class="col-xs-6 col-xs-offset-3" style="text-align: center;" id="startbutton">
<h1>Waiting autorization for access to webcam </h1>
</div>
</div>
<br/>
<video id="videoel" width="400" height="300" preload="auto" loop>
</video>
<canvas id="overlay" width="400" height="300"></canvas>
</div>
<!-- <input class="btn" width="400" height="300" type="button" value="wait, loading video" disabled="disabled" onclick="startVideo()" id="startbutton"></input> -->
<input class="btn" width="400" height="300" type="button" value="Save your facial data" onclick=saveInfo() id="saveButton"></input>
</div>
<script>
var vid = document.getElementById('videoel');
var overlay = document.getElementById('overlay');
var overlayCC = overlay.getContext('2d');
var bool = false;
var ctrack = new clm.tracker({useWebGL : true});
ctrack.init(pModel);
var saveButton = document.getElementById('savebutton');
stats = new Stats();
function enablestart() {
//startbutton.value = "start";
$('#startbutton').html("<h2>Please click the save button when the mask fits your face.</h2>");
bool = true;
startVideo();
}
var insertAltVideo = function(video) {
if (supports_video()) {
if (supports_ogg_theora_video()) {
video.src = "./media/cap12_edit.ogv";
} else if (supports_h264_baseline_video()) {
video.src = "./media/cap12_edit.mp4";
} else {
return false;
}
//video.play();
return true;
} else return false;
}
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
window.URL = window.URL || window.webkitURL || window.msURL || window.mozURL;
// check for camerasupport
if (navigator.getUserMedia) {
// set up stream
var videoSelector = {video : true};
if (window.navigator.appVersion.match(/Chrome\/(.*?) /)) {
var chromeVersion = parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10);
if (chromeVersion < 20) {
videoSelector = "video";
}
};
navigator.getUserMedia(videoSelector, function( stream ) {
if (vid.mozCaptureStream) {
vid.mozSrcObject = stream;
} else {
vid.src = (window.URL && window.URL.createObjectURL(stream)) || stream;
}
vid.play();
}, function() {
insertAltVideo(vid);
document.getElementById('gum').className = "hide";
document.getElementById('nogum').className = "nohide";
alert("There was some problem trying to fetch video from your webcam, using a fallback video instead.");
});
} else {
insertAltVideo(vid);
document.getElementById('gum').className = "hide";
document.getElementById('nogum').className = "nohide";
alert("Your browser does not seem to support getUserMedia, using a fallback video instead.");
}
vid.addEventListener('canplay', enablestart, false);
function startVideo() {
if(bool == true)
{
// start video
vid.play();
// start tracking
ctrack.start(vid);
// start loop to draw face
drawLoop();
}
}
function drawLoop() {
requestAnimFrame(drawLoop);
overlayCC.clearRect(0, 0, 400, 300);
//psrElement.innerHTML = "score :" + ctrack.getScore().toFixed(4);
if (ctrack.getCurrentPosition()) {
ctrack.draw(overlay);
}
}
function saveInfo(){
if(bool == true)
{
var positions = ctrack.getCurrentPosition();
var ratioList = new Array();
ratioList[0] = distance(positions[0], positions[14]) / distance(positions[1], positions[13]) ;
ratioList[1] = distance(positions[27], positions[32]) / distance(positions[33], positions[62]) ;
ratioList[2] = distance(positions[62], positions[5]) / distance(positions[62], positions[9]) ;
ratioList[3] = distance(positions[27], positions[62]) / distance(positions[32], positions[62]) ;
ratioList[4] = distance(positions[27], positions[36]) / distance(positions[32], positions[38]) ;
ratioList[5] = distance(positions[3], positions[11]) / distance(positions[35], positions[39]);
ratioList[6] = distance(positions[47], positions[53]) / distance(positions[60], positions[57]);
ratioList[7] = distance(positions[23], positions[28]) / distance(positions[25], positions[30]);
ratioList[8] = distance(positions[62], positions[36]) / distance(positions[62], positions[38]);
ratioList[9] = distance(positions[19], positions[27]) / distance(positions[15], positions[32]);
console.log(ratioList[0]);
localStorage.facedata = JSON.stringify(ratioList);
}
}
function distance(point1, point2){
return Math.sqrt((point2[0]-point1[0])*(point2[0]-point1[0]) + (point2[1]-point1[1]) * (point2[1]-point1[1]) )
}
// update stats on every iteration
document.addEventListener('clmtrackrIteration', function(event) {
stats.update();
}, false);
</script>
</body>
</html>