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 14:04:40 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
da52a162390233ddc841544520250c1c893455c7
da52a162
1 parent
1330da5f
Opencv.js face detection
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
flask/static/js/utils.js
flask/templates/index.html
flask/static/js/utils.js
View file @
da52a16
...
...
@@ -161,4 +161,4 @@ function Utils(errorOutputId) { // eslint-disable-line no-unused-vars
this
.
stream
.
getVideoTracks
()[
0
].
stop
();
}
};
};
\ No newline at end of file
};
...
...
flask/templates/index.html
View file @
da52a16
...
...
@@ -22,18 +22,19 @@
background-color
:
#666
;
}
</style>
<script
type=
'text/javascript'
src=
"{{url_for('static', filename='js/opencv.js')}}"
></script>
<script
type=
'text/javascript'
src=
"{{url_for('static', filename='js/utils.js')}}"
></script>
<script
type=
'text/javascript'
>
let
utils
=
new
Utils
(
'errorMessage'
);
utils
.
loadOpenCv
(()
=>
{
let
faceCascadeFile
=
'/static/js/haarcascade_frontalface_default.xml'
;
utils
.
createFileFromUrl
(
faceCascadeFile
,
faceCascade
File
,
()
=>
{
alert
(
faceCascadeFile
);
function
load_cascade
()
{
let
faceCascadeFile
=
'haarcascade_frontalface_default.xml'
let
faceCascadeURL
=
'static/js/haarcascade_frontalface_default.xml'
let
utils
=
new
Utils
(
'errorMessage'
);
utils
.
createFileFromUrl
(
faceCascadeFile
,
faceCascade
URL
,
()
=>
{
main
()
});
}
);
}
function
main
()
{
let
video
=
document
.
getElementById
(
"videoInput"
);
...
...
@@ -56,7 +57,7 @@ let faces = new cv.RectVector();
let
classifier
=
new
cv
.
CascadeClassifier
();
var
streaming
=
true
;
classifier
.
load
(
'
static/js/
haarcascade_frontalface_default.xml'
);
classifier
.
load
(
'haarcascade_frontalface_default.xml'
);
const
FPS
=
30
;
function
processVideo
()
{
...
...
@@ -99,7 +100,7 @@ setTimeout(processVideo, 0);
}
</script>
</head>
<body
onload=
"cv['onRuntimeInitialized']=()=>{
main
() }"
>
<body
onload=
"cv['onRuntimeInitialized']=()=>{
load_cascade
() }"
>
<div
id=
"container"
>
<video
autoplay=
"true"
id=
"videoInput"
width=
640
height=
480
>
<!-- style="visibility: hidden"-->
...
...
Please
register
or
login
to post a comment