Face Registration is integrated with Database.

This commit is contained in:
Batuhan Berk Başoğlu 2020-11-14 12:28:50 -05:00
parent 2e81cb7d99
commit da462f2cba
336 changed files with 32 additions and 29 deletions

View file

@ -100,13 +100,13 @@ def get_address(user_id):
# Uploads the photo of user, input should be something like "example.png" # Uploads the photo of user, input should be something like "example.png"
def upload_user_photo(user_photo): def upload_user_photo(user_id):
storage.child("Photos_of_Users/" + user_photo).put("Photos_of_Users/" + user_photo) 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" # Uploads the photo of thief, input should be something like "example.png"
def upload_thief_photo(user_photo): def upload_thief_photo(thief_id):
storage.child("Photos_of_Thieves/" + user_photo).put("Photos_of_Thieves/" + user_photo) storage.child("Photos_of_Thieves/" + thief_id).put("Facial_images/face_rec/train/" + thief_id)
# Downloads the specified user photo. # Downloads the specified user photo.
@ -127,3 +127,5 @@ def delete_user_photo(user_photo):
# Deletes photo of the specified thief. # Deletes photo of the specified thief.
def delete_thief_photo(user_photo): def delete_thief_photo(user_photo):
storage.delete('Photos_of_Thieves/' + user_photo) storage.delete('Photos_of_Thieves/' + user_photo)
upload_data("1", "Batuhan", "Basoglu", "bbaso079@uottawa.ca", "6138072241", "257 Lisgar Street")

View file

@ -4,30 +4,27 @@ import math
import cv2 import cv2
label = "Batuhan_Basoglu" def register_your_face(label):
num_cap = 20 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: cap = cv2.VideoCapture(0)
os.makedirs(path) c = 0
while c < num_cap:
ret, frame = cap.read()
cv2.imshow("capture", frame)
cap = cv2.VideoCapture(0) cv2.imwrite(path + '/' + str(c) + '.jpg', frame)
c=0
while(c < num_cap):
ret, frame = cap.read() c = c + 1
cv2.waitKey(500)
cv2.imshow("capture", frame) cap.release()
cv2.destroyAllWindows()
cv2.imwrite(path+'/'+str(c) + '.jpg', frame)
c=c+1
cv2.waitKey(500)
cap.release()
cv2.destroyAllWindows()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

View file

@ -67,7 +67,7 @@ class Motor:
elif userStop=="N": elif userStop=="N":
return False return False
else: else:
stop_motor(self) self.stop_motor(self)
def start_alarm(self): def start_alarm(self):

View file

@ -1,5 +1,5 @@
import DBHelper import DBHelper
import Facial_Recognition_Software import Facial_Recognition_Registration
def upload_your_face(firstname, lastname, email, phone, address): def upload_your_face(firstname, lastname, email, phone, address):
@ -10,8 +10,12 @@ def upload_your_face(firstname, lastname, email, phone, address):
try: try:
for user in users.each(): for user in users.each():
count += 1 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: except:
DBHelper.upload_data("1", firstname, lastname, email, phone, address) 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")

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more