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-28 08:48:58 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6e7fc1c6cfa3387071fa18dddda93829f37c767b
6e7fc1c6
1 parent
9fbe1035
Update app.py
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
flask/app.py
flask/app.py
View file @
6e7fc1c
...
...
@@ -44,6 +44,9 @@ def get_distance(arr1, arr2):
distance
=
np
.
linalg
.
norm
(
arr1
-
arr2
)
return
distance
def
get_brightness
(
arr
):
return
np
.
average
(
np
.
linalg
.
norm
(
arr
,
axis
=
2
))
/
np
.
sqrt
(
3
)
@app.route
(
'/'
)
def
index
():
"""Video streaming page"""
...
...
@@ -74,6 +77,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
)
# change brightness
# cv2.add(image_np, np.array([x]))
image_np
=
cv2
.
cvtColor
(
image_np
,
cv2
.
COLOR_BGR2RGB
)
image_np
=
prewhiten
(
image_np
)
image_np
=
resize
(
image_np
)
...
...
@@ -101,6 +106,7 @@ 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
)
print
(
get_brightness
(
image_np
))
image_np
=
cv2
.
cvtColor
(
image_np
,
cv2
.
COLOR_BGR2RGB
)
image_np
=
prewhiten
(
image_np
)
image_np
=
resize
(
image_np
)
...
...
Please
register
or
login
to post a comment