Graduate

Update app.py

......@@ -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)
......