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-24 15:14:44 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0906f3a099cd669644d39c81beb302ee1806d7ca
0906f3a0
1 parent
628cc75e
TODO: img transfer from frontend to backend
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
flask/run
flask/templates/index.html
flask/run
deleted
100644 → 0
View file @
628cc75
flask run --cert=cert.pem --key=key.pem
flask/templates/index.html
View file @
0906f3a
...
...
@@ -76,17 +76,24 @@ function processVideo() {
let
msize
=
new
cv
.
Size
(
120
,
120
);
classifier
.
detectMultiScale
(
gray
,
faces
,
1.1
,
3
,
0
,
msize
);
// draw faces.
var
images
=
new
Array
();
for
(
let
i
=
0
;
i
<
faces
.
size
();
++
i
)
{
let
face
=
faces
.
get
(
i
);
let
point1
=
new
cv
.
Point
(
face
.
x
,
face
.
y
);
let
point2
=
new
cv
.
Point
(
face
.
x
+
face
.
width
,
face
.
y
+
face
.
height
);
let
rect
=
cv
.
Rect
(
face
.
x
,
face
.
y
,
face
.
x
+
face
.
width
,
face
.
y
+
face
.
height
)
cv
.
rectangle
(
dst
,
point1
,
point2
,
[
255
,
0
,
0
,
255
]);
let
roi
=
src
.
roi
(
rect
);
let
img
=
cv
.
imencode
(
'jpg'
,
roi
).
toString
(
'base64'
);
alert
(
img
);
images
.
append
(
img
);
let
cropped
=
new
cv
.
Mat
();
let
rect
=
new
cv
.
Rect
(
face
.
x
,
face
.
y
,
face
.
width
,
face
.
height
);
cropped
=
src
.
roi
(
rect
);
let
tempCanvas
=
document
.
createElement
(
"canvas"
);
cv
.
imshow
(
tempCanvas
,
cropped
);
let
b64encoded
=
tempCanvas
.
toDataURL
(
'image/jpeg'
,
1.0
);
var
msg
=
{
action
:
"verify"
,
img
:
b64encoded
,
date
:
Date
.
now
()
};
let
socket
=
new
WebSocket
(
"ws://13.124.104.70:3000"
);
socket
.
send
(
JSON
.
stringify
(
msg
));
}
cv
.
imshow
(
'canvasOutput'
,
dst
);
// schedule the next one.
...
...
@@ -102,8 +109,8 @@ setTimeout(processVideo, 0);
</head>
<body
onload=
"cv['onRuntimeInitialized']=()=>{ load_cascade() }"
>
<div
id=
"container"
>
<video
autoplay=
"true"
id=
"videoInput"
width=
640
height=
480
style=
"display: none;"
></video>
<canvas
id=
"canvasOutput"
width=
640
height=
480
></canvas>
</div>
<video
autoplay=
"true"
id=
"videoInput"
width=
640
height=
480
style=
"display: none;"
>
</video>
</body>
</html>
...
...
Please
register
or
login
to post a comment