Face Registration is integrated with Database.
10
DBHelper.py
|
@ -100,13 +100,13 @@ def get_address(user_id):
|
|||
|
||||
|
||||
# Uploads the photo of user, input should be something like "example.png"
|
||||
def upload_user_photo(user_photo):
|
||||
storage.child("Photos_of_Users/" + user_photo).put("Photos_of_Users/" + user_photo)
|
||||
def upload_user_photo(user_id):
|
||||
storage.child("Photos_of_Users/" + user_id).put("Facial_images/face_rec/train/" + user_id)
|
||||
|
||||
|
||||
# Uploads the photo of thief, input should be something like "example.png"
|
||||
def upload_thief_photo(user_photo):
|
||||
storage.child("Photos_of_Thieves/" + user_photo).put("Photos_of_Thieves/" + user_photo)
|
||||
def upload_thief_photo(thief_id):
|
||||
storage.child("Photos_of_Thieves/" + thief_id).put("Facial_images/face_rec/train/" + thief_id)
|
||||
|
||||
|
||||
# Downloads the specified user photo.
|
||||
|
@ -127,3 +127,5 @@ def delete_user_photo(user_photo):
|
|||
# Deletes photo of the specified thief.
|
||||
def delete_thief_photo(user_photo):
|
||||
storage.delete('Photos_of_Thieves/' + user_photo)
|
||||
|
||||
upload_data("1", "Batuhan", "Basoglu", "bbaso079@uottawa.ca", "6138072241", "257 Lisgar Street")
|
|
@ -4,30 +4,27 @@ import math
|
|||
import cv2
|
||||
|
||||
|
||||
label = "Batuhan_Basoglu"
|
||||
num_cap = 20
|
||||
def register_your_face(label):
|
||||
num_cap = 20
|
||||
|
||||
path = sys.path[0]+'/Facial_images/face_rec/train/'+label
|
||||
path = sys.path[0] + '/Facial_images/face_rec/train/' + label
|
||||
|
||||
folder = os.path.exists(path)
|
||||
|
||||
folder = os.path.exists(path)
|
||||
if not folder:
|
||||
os.makedirs(path)
|
||||
|
||||
if not folder:
|
||||
os.makedirs(path)
|
||||
cap = cv2.VideoCapture(0)
|
||||
c = 0
|
||||
while c < num_cap:
|
||||
ret, frame = cap.read()
|
||||
|
||||
cv2.imshow("capture", frame)
|
||||
|
||||
cap = cv2.VideoCapture(0)
|
||||
c=0
|
||||
while(c < num_cap):
|
||||
cv2.imwrite(path + '/' + str(c) + '.jpg', frame)
|
||||
|
||||
ret, frame = cap.read()
|
||||
c = c + 1
|
||||
cv2.waitKey(500)
|
||||
|
||||
cv2.imshow("capture", frame)
|
||||
|
||||
cv2.imwrite(path+'/'+str(c) + '.jpg', frame)
|
||||
|
||||
c=c+1
|
||||
cv2.waitKey(500)
|
||||
|
||||
cap.release()
|
||||
cv2.destroyAllWindows()
|
||||
cap.release()
|
||||
cv2.destroyAllWindows()
|
||||
|
|
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB |
|
@ -67,7 +67,7 @@ class Motor:
|
|||
elif userStop=="N":
|
||||
return False
|
||||
else:
|
||||
stop_motor(self)
|
||||
self.stop_motor(self)
|
||||
|
||||
|
||||
def start_alarm(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import DBHelper
|
||||
import Facial_Recognition_Software
|
||||
import Facial_Recognition_Registration
|
||||
|
||||
|
||||
def upload_your_face(firstname, lastname, email, phone, address):
|
||||
|
@ -10,8 +10,12 @@ def upload_your_face(firstname, lastname, email, phone, address):
|
|||
try:
|
||||
for user in users.each():
|
||||
count += 1
|
||||
DBHelper.upload_data(count, firstname, lastname, email, phone, address)
|
||||
DBHelper.upload_data("user_" + str(count), firstname, lastname, email, phone, address)
|
||||
Facial_Recognition_Registration.register_your_face("user_" + str(count))
|
||||
for x in range(20):
|
||||
DBHelper.upload_user_photo("user_" + str(count) + "/" + str(x) + ".jpg")
|
||||
except:
|
||||
DBHelper.upload_data("1", firstname, lastname, email, phone, address)
|
||||
|
||||
|
||||
Facial_Recognition_Registration.register_your_face("user_1")
|
||||
for x in range(20):
|
||||
DBHelper.upload_user_photo("user_1/" + str(x) + ".jpg")
|
||||
|
|