-
Notifications
You must be signed in to change notification settings - Fork 4
/
DynamicAddition.py
34 lines (26 loc) · 1002 Bytes
/
DynamicAddition.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import cv2
from EncodingModel import *
import numpy as np
def pauseCamera():
cv2.waitKey(-100)
def dynamicAdd(image):
firstName = input("What is your first name: ")
lastName = input("What is your last name: ")
fullName = firstName + " " + lastName
with open("List Information/Full Student Names", "a") as f:
f.write(fullName)
f.write("\n")
f.close()
with open("List Information/Face Names Known", "a") as f:
f.write(firstName)
f.write("\n")
f.close()
with open("List Information/Encoding Names", "a") as f:
f.write(firstName + "Encoding.npy")
f.write("\n")
f.close()
os.makedirs("People Images/" + firstName)
cv2.imwrite(os.path.join("People Images/" + firstName, '0.jpg'), image)
cv2.imwrite(os.path.join("People Images/" + firstName, '1.jpg'), image)
encoding = encodeDirectory(firstName)
np.save('Encodings/' + str(firstName).replace(" ", "") + 'Encoding.npy', encoding)