Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2014104149
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Graduate
2020-11-23 11:11:09 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6309614cfd22b16014e32b08999ba0b4ba274ce4
6309614c
1 parent
3ad8229b
Opencv.js face detection
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
flask/templates/index.html
flask/templates/index.html
View file @
6309614
...
...
@@ -16,6 +16,8 @@
height
:
480px
;
background-color
:
#666
;
}
</style>
</head>
...
...
@@ -24,7 +26,7 @@
<video
autoplay=
"true"
id=
"videoElement"
>
<!-- style="visibility: hidden"-->
</video>
<canvas
id=
'canvasOutput'
>
<canvas
id=
'canvasOutput'
width=
'640'
height=
'480'
>
</canvas>
</div>
...
...
@@ -41,12 +43,19 @@ if (navigator.mediaDevices.getUserMedia){
}
</script>
<script>
cv
[
'onRuntimeInitialized'
]
=
()
=>
{
let
video
=
document
.
getElementById
(
'videoElement'
);
let
src
=
new
cv
.
Mat
(
video
.
height
,
video
.
width
,
cv
.
CV_8UC4
);
let
dst
=
new
cv
.
Mat
(
video
.
height
,
video
.
width
,
cv
.
CV_8UC4
);
let
gray
=
new
cv
.
Mat
();
let
cap
=
new
cv
.
RectVector
();
let
cap
=
new
cv
.
VideoCapture
(
video
);
let
faces
=
new
cv
.
RectVector
();
let
classifier
=
new
cv
.
CascadeClassifier
();
var
streaming
=
true
;
if
(
typeof
streaming
===
'undefined'
)
{
streaming
=
false
;
}
classifier
.
load
(
"{{url_for('static', filename='js/haarcascade_frontalface_default.xml')}}"
)
const
FPS
=
30
;
function
processVideo
()
{
...
...
@@ -79,13 +88,12 @@ if (navigator.mediaDevices.getUserMedia){
let
delay
=
1000
/
FPS
-
(
Date
.
now
()
-
begin
);
setTimeout
(
processVideo
,
delay
);
}
catch
(
err
)
{
utils
.
printError
(
err
);
console
.
log
(
err
);
}
}
// schedule the first one.
cv
[
'onRuntimeInitialized'
]
=
()
=>
{
setTimeout
(
processVideo
,
0
);
}
setTimeout
(
processVideo
,
0
);
}
</script>
</body>
</html>
...
...
Please
register
or
login
to post a comment