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"
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")

View file

@ -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:
if not folder:
os.makedirs(path)
cap = cv2.VideoCapture(0)
c=0
while(c < num_cap):
cap = cv2.VideoCapture(0)
c = 0
while c < num_cap:
ret, frame = cap.read()
cv2.imshow("capture", frame)
cv2.imwrite(path+'/'+str(c) + '.jpg', frame)
cv2.imwrite(path + '/' + str(c) + '.jpg', frame)
c=c+1
c = c + 1
cv2.waitKey(500)
cap.release()
cv2.destroyAllWindows()
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":
return False
else:
stop_motor(self)
self.stop_motor(self)
def start_alarm(self):

View file

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

Binary file not shown.

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