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-25 04:19:57 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
103175f847abbb3b27ea83323894a3e04e878415
103175f8
1 parent
0906f3a0
Move verification server to flask
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
19 deletions
flask/app.py
flask/templates/index.html
requirements.txt
server/DB.cnf
flask/app.py
View file @
103175f
from
flask
import
Flask
,
render_template
,
Response
,
request
from
flask
import
Flask
,
render_template
,
Response
,
request
,
jsonify
import
json
import
cv2
import
numpy
as
np
import
time
...
...
@@ -6,7 +7,6 @@ import datetime
import
sys
faceCascade
=
cv2
.
CascadeClassifier
(
"haarcascade_frontalface_default.xml"
)
num
=
3
app
=
Flask
(
__name__
)
@app.route
(
'/'
)
...
...
@@ -15,7 +15,11 @@ def index():
return
render_template
(
'index.html'
)
@app.route
(
'/submit'
,
methods
=
[
'POST'
])
def
submit
():
image
=
request
.
args
.
get
(
'image'
)
print
(
type
(
image
))
@app.route
(
'/verify'
,
methods
=
[
'POST'
])
def
verify
():
image
=
request
.
form
[
'image'
]
data
=
request
.
form
[
'data'
]
return
jsonify
(
test
)
#recv = verify_face(image)
#return recv
...
...
flask/templates/index.html
View file @
103175f
...
...
@@ -6,8 +6,8 @@
<style>
#container
{
margin
:
0px
auto
;
width
:
128
0px
;
height
:
12
80px
;
width
:
64
0px
;
height
:
4
80px
;
border
:
10px
#333
solid
;
}
#videoInput
{
...
...
@@ -19,6 +19,7 @@
</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
src=
"https://code.jquery.com/jquery-1.12.4.min.js"
></script>
<script
type=
'text/javascript'
>
function
load_cascade
()
{
...
...
@@ -86,14 +87,13 @@ function processVideo() {
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
));
let
b64encoded
=
tempCanvas
.
toDataURL
(
"image/jpeg"
,
1.0
);
$
.
ajax
({
type
:
"POST"
,
url
:
"{{url_for('verify')}}"
,
dataType
:
"json"
,
data
:
{
'image'
:
b64encoded
,
'data'
:
'testestest'
}
});
}
cv
.
imshow
(
'canvasOutput'
,
dst
);
// schedule the next one.
...
...
@@ -111,6 +111,7 @@ setTimeout(processVideo, 0);
<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
id=
"hidden_container"
style=
"display: none;"
><div>
</div>
</body>
</html>
...
...
requirements.txt
View file @
103175f
...
...
@@ -4,3 +4,4 @@ opencv-python==4.1.1.26
websockets
cryptography
pymysql
flask
...
...
server/DB.cnf
View file @
103175f
[client]
user=
root
password=
1234
host=
localhost
user=
admin
password=
attendance
host=
attendance-system.c4yvip5o6czh.ap-northeast-2.rds.amazonaws.com
database=attendance
charset=utf8
...
...
Please
register
or
login
to post a comment