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-26 08:42:49 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
71f921c1303780e26c6d6299f31e8cbf5a37efbd
71f921c1
1 parent
18d9eaa2
Update flask
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
flask/app.py
flask/templates/index.html
flask/templates/register.html
flask/app.py
View file @
71f921c
...
...
@@ -11,6 +11,7 @@ import tensorflow as tf
import
base64
import
pymysql
import
configparser
import
uuid
from
PIL
import
Image
config
=
configparser
.
ConfigParser
()
...
...
@@ -74,8 +75,8 @@ def register():
image
=
base64
.
b64decode
(
request
.
form
[
'image'
])
image_np
=
np
.
frombuffer
(
image
,
dtype
=
np
.
uint8
)
image_np
=
cv2
.
imdecode
(
image_np
,
cv2
.
IMREAD_UNCHANGED
)
image_np
=
resize
(
image_np
)
image_np
=
prewhiten
(
image_np
)
image_np
=
resize
(
image_np
)
image_np
=
image_np
.
reshape
(
-
1
,
image_size
,
image_size
,
3
)
# get embedding
feed_dict
=
{
input_placeholder
:
image_np
,
phase_train_placeholder
:
False
}
...
...
@@ -100,8 +101,8 @@ def verify():
image
=
base64
.
b64decode
(
request
.
form
[
'image'
])
image_np
=
np
.
frombuffer
(
image
,
dtype
=
np
.
uint8
)
image_np
=
cv2
.
imdecode
(
image_np
,
cv2
.
IMREAD_UNCHANGED
)
image_np
=
resize
(
image_np
)
image_np
=
prewhiten
(
image_np
)
image_np
=
resize
(
image_np
)
image_np
=
image_np
.
reshape
(
-
1
,
image_size
,
image_size
,
3
)
# get embedding
feed_dict
=
{
input_placeholder
:
image_np
,
phase_train_placeholder
:
False
}
...
...
flask/templates/index.html
View file @
71f921c
...
...
@@ -127,7 +127,7 @@ function processVideo() {
let
point2
=
new
cv
.
Point
(
face
.
x
+
face
.
width
,
face
.
y
+
face
.
height
);
cv
.
rectangle
(
dst
,
point1
,
point2
,
[
255
,
0
,
0
,
255
],
8
);
let
cropped
=
new
cv
.
Mat
();
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
face
.
width
/
4
,
0
),
Math
.
max
(
face
.
y
-
face
.
height
/
2
,
0
),
Math
.
min
(
face
.
width
+
face
.
width
/
2
,
src
.
cols
),
Math
.
min
(
face
.
height
*
2
,
src
.
rows
));
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
22
,
0
),
Math
.
max
(
face
.
y
-
44
,
0
),
Math
.
min
(
face
.
width
+
44
,
src
.
cols
),
Math
.
min
(
face
.
height
+
66
,
src
.
rows
));
cropped
=
src
.
roi
(
rect
);
let
tempCanvas
=
document
.
createElement
(
"canvas"
);
cv
.
imshow
(
tempCanvas
,
cropped
);
...
...
flask/templates/register.html
View file @
71f921c
...
...
@@ -61,7 +61,7 @@ function detect_face()
let
point1
=
new
cv
.
Point
(
face
.
x
,
face
.
y
);
let
point2
=
new
cv
.
Point
(
face
.
x
+
face
.
width
,
face
.
y
+
face
.
height
);
cv
.
rectangle
(
dst
,
point1
,
point2
,
[
255
,
0
,
0
,
255
],
8
);
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
face
.
width
/
4
,
0
),
Math
.
max
(
face
.
y
-
face
.
height
/
2
,
0
),
Math
.
min
(
face
.
width
+
face
.
width
/
2
,
src
.
cols
),
Math
.
min
(
face
.
height
*
2
,
src
.
rows
));
let
rect
=
new
cv
.
Rect
(
Math
.
max
(
face
.
x
-
22
,
0
),
Math
.
max
(
face
.
y
-
44
,
0
),
Math
.
min
(
face
.
width
+
44
,
src
.
cols
),
Math
.
min
(
face
.
height
+
66
,
src
.
rows
));
let
cropped
=
src
.
roi
(
rect
);
cv
.
imshow
(
tempCanvas
,
cropped
);
}
...
...
Please
register
or
login
to post a comment