forked from LumBeqiri/EmotionDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
219 lines (158 loc) · 7.09 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,800" , rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel='icon' href='images/favicon.ico' type='image/x-icon' >
<!-- <link href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.0/jquery.fancybox.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.0/jquery.fancybox.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.0/jquery.fancybox.min.css">
<link rel="stylesheet" href="style.css">
<title>Home</title>
</head>
<body>
<nav class="topnav" id="myTopnav">
<a href="index.html"><img src="images/logo.svg" width="40px" alt="logo"></a>
<a href="index.html" class="active">Home</a>
<a href="emotions.html">Emotions</a>
<!-- <a href="mission.html">Our mission</a> -->
<a href="about.html">About</a>
<a href="contact.html">Contact</a>
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
<i class="fa fa-bars"></i>
</a>
</nav>
<header class="content_style_poppins" style="text-align: center;">
<h1>Emotion Detector Ahead!</h1>
<p>Turn on the camera, and start the journey of emotions</p>
</header>
<div class="video_photo">
<div id="capture" class="video-panel">
<video id="video" width="720px" height="560px" autoplay muted></video>
<canvas id="canvas" width="720px" height="560px"></canvas>
</div>
</div>
<section class="button-panel">
<div class="modal" id="myModal"></div>
<button class="button" style="z-index: 1;" id="snap" onclick="snap()">Snap Photo</button>
<a class="paragraph_style" style="cursor:pointer;margin-top: 10px" id="downloadLnk" download="YourFileName.jpg">Download as
image</a>
</section>
<footer class="footer">
<div class="fitem-1">
<h2>Navigation</h2>
<div class="footer-nav">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="emotions.html">Emotions</a></li>
<!-- <li><a href="mission.html">Our mission</a></li> -->
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
</div>
<div class="fitem-2">
<h2>Newsletter</h2>
<div class"newsletter">
<p>Enter your email address and subcribe daily newsletter</p>
<form method="post">
<input class="email-form" type="email" placeholder="[email protected]">
<button class="submit-button" type="submit" data-validation="required email">Subscribe</button>
</form>
</div>
<div class="social">
<a href=""><i class="fab fcolor fa-facebook fa-2x"></i></a>
<a href=""><i class="fab tcolor fa-twitter fa-2x"></i></a>
<a href=""><i class="fab licolor fa-linkedin-in fa-2x"></i></a>
<a href=""><i class="fab instcolor fa-instagram fa-2x"></i></a>
<a href=""><i class="fab mediumcolor fa-medium fa-2x"></i></a>
</div>
</div>
<div class="fitem-3">
<h2>Contacts</h2>
<div class="our-app">
<div class="android-app">
<i class="fas fa-phone"></i>
<p style="text-align: center"><span>Kosova:</span>(+383) 44 123 456</p>
</div>
<div class="android-app">
<i class="fas fa-phone"></i>
<p style="text-align: center"><span>USA:</span>(+1) 123 456 7891</p>
</div>
</div>
</div>
</footer>
<!--footer ends here-->
<script>
// code below used to only take a screenshot of the video not the expressions
var videol = document.querySelector('video');
var canvast = document.querySelector('canvas');
var context = canvast.getContext('2d');
var w, h, ratio;
var img_canvas;
videol.addEventListener('loadedmetadata', function () {
ratio = videol.videoWidth / videol.videoHeight;
w = video.videoWidth + 80;
h = video.height;
canvast.width = w;
canvast.height = h;
}, false);
function snap() {
context.fillRect(0, 0, w, h);
context.drawImage(videol, 0, 0, w, h);
Swal.fire({
icon: 'success',
title: 'Snap Success!',
text: 'Click "Download as image" to download it',
})
html2canvas(document.querySelector("#capture"),
{
scrollX : 0,
scrollY: -window.scrollY
}).then(canvas => {
document.getElementById('myModal').appendChild(canvas)
img_canvas = canvas
}, );
// window.open('', document.getElementById('screenshot').toDataURL());
context.clearRect(0, 0, canvas.width, canvas.height);
}
function download() {
saveAs(img_canvas.toDataURL(), 'file-name.png');
};
downloadLnk.addEventListener('click', download, false);
function saveAs(uri, filename) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
link.href = uri;
link.download = filename;
//Firefox requires the link to be in the body
document.body.appendChild(link);
//simulate click
link.click();
//remove the link when done
document.body.removeChild(link);
} else {
window.open(uri);
}
}
function myFunction() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
</script>
<script src="html2canvas.js"></script>
<script defer src="face-api.min.js"></script>
<script defer src="script.js"></script>
</body>
</html>