Fixed the files.

This commit is contained in:
Batuhan Berk Başoğlu 2021-02-04 17:41:59 -05:00
parent 02677fee34
commit f2ff3e7a96
34 changed files with 54 additions and 19 deletions

View file

@ -78,7 +78,7 @@ def upload_user_photo(user_id):
# Uploads the photos of thief, input should be something like "example.jpg"
def upload_thief_photo(thief_id):
storage.child("Photos_of_Thieves/" + thief_id).put("Facial_images/face_rec/train/" + thief_id)
storage.child("Photos_of_Thieves/" + thief_id).put("Photos_of_Thieves/" + thief_id)
# Downloads the specified user's photos, input should be something like "example.jpg"
@ -221,5 +221,4 @@ def upload_thief_data(thief_id, date, time):
if __name__ == "__main__":
upload_register_data("RandomFirst", "RandomLast", "Random@gmail.com", "0000000000")
upload_removal_data("RandomFirst", "RandomLast", "Random@gmail.com", "0000000000")
upload_data("User_3", "RandomFirst", "RandomLast", "Random@gmail.com", "0000000000")

View file

@ -33,6 +33,7 @@ def inference():
x1 = x2 = y1 = y2 = 0
cond = False
thief = False
thief_time = 0
label = 'unknown'
@ -100,19 +101,19 @@ def inference():
DBHelper.set_motor("on")
DBHelper.set_alarm("off")
thief_time = 0
time.sleep(1)
elif not cond:
DBHelper.set_motor("off")
DBHelper.set_alarm("on")
thief_time += 1
time.sleep(1)
if thief_time == 120:
Upload_Thief.upload_thief_face()
if thief_time == 10:
thief = True
DBHelper.set_power("off")
DBHelper.set_alarm("off")
DBHelper.set_motor("off")
cv2.destroyAllWindows()
if thief:
Upload_Thief.upload_thief_face()
if __name__ == "__main__":

View file

@ -0,0 +1,39 @@
import sys
import os
import math
import cv2
def register_your_face(label):
num_cap = 50
path = sys.path[0] + '/Photos_of_Thieves/' + label
folder = os.path.exists(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)
cv2.imwrite(path + '/' + str(c) + '.jpg', frame)
c = c + 1
cv2.waitKey(500)
cap.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
print("Face registration start...")
print()
label = input('Pleas enter your Name/Label: ')
register_your_face(label)
print("Data is successfully saved.")
print()

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: 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

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.

Binary file not shown.

View file

@ -5,10 +5,10 @@ import Remove_Face
import Check_Up
if __name__ == "__main__":
Check_Up.update()
print("Starting the Program.")
while True:
if DBHelper.get_power() == "on":
Check_Up.update()
Start_Engine.start()
if None not in (DBHelper.get_register_firstname(),
@ -17,14 +17,12 @@ if __name__ == "__main__":
DBHelper.get_register_phone()):
Upload_Face.upload_your_face(DBHelper.get_register_firstname(), DBHelper.get_register_lastname(),
DBHelper.get_register_email(), DBHelper.get_register_phone())
Check_Up.update()
DBHelper.remove_register_data()
if None not in (DBHelper.get_removal_firstname(),
DBHelper.get_removal_lastname(),
DBHelper.get_removal_email(),
DBHelper.get_removal_phone()):
Check_Up.update()
Remove_Face.remove_your_face(DBHelper.get_removal_firstname(), DBHelper.get_removal_lastname(),
DBHelper.get_removal_email(), DBHelper.get_removal_phone())
DBHelper.remove_removal_data()

View file

@ -1,6 +1,7 @@
import DBHelper
import os
import shutil
import Facial_Recognition_Enrollment
def remove_your_face(firstname, lastname, email, phone):
@ -52,6 +53,7 @@ def remove_your_face(firstname, lastname, email, phone):
DBHelper.delete_user_photo("User_" + str(count2 + 1) + "/" + str(i) + ".jpg")
DBHelper.remove_data("User_" + str(count))
shutil.rmtree("Facial_images/face_rec/train/User_" + str(count))
Facial_Recognition_Enrollment.enroll_face_dataset()
print("Success.")
except:
print("No Users exist for User Removal.")

View file

@ -1,6 +1,5 @@
import DBHelper
import Facial_Recognition_Registration
import Facial_Recognition_Enrollment
import Facial_Recognition_Thief_Registration
from datetime import datetime
@ -13,8 +12,7 @@ def upload_thief_face():
count = 1
for thief in thieves.each():
count += 1
Facial_Recognition_Registration.register_your_face("Thief_" + str(count))
Facial_Recognition_Enrollment.enroll_face_dataset()
Facial_Recognition_Thief_Registration.register_your_face("Thief_" + str(count))
for i in range(50):
DBHelper.upload_thief_photo("Thief_" + str(count) + "/" + str(i) + ".jpg")
date = datetime.now().strftime("%d/%m/%Y")
@ -22,14 +20,12 @@ def upload_thief_face():
DBHelper.upload_thief_data("Thief_" + str(count), date, time)
print("An intruder is recorded.")
except:
DBHelper.upload_thief_data("Thief_1", date, time)
Facial_Recognition_Registration.register_your_face("Thief_1")
Facial_Recognition_Enrollment.enroll_face_dataset()
Facial_Recognition_Thief_Registration.register_your_face("Thief_1")
for i in range(50):
DBHelper.upload_thief_photo("Thief_1/" + str(i) + ".jpg")
date = datetime.now().strftime("%d/%m/%Y")
time = datetime.now().strftime("%H:%M:%S")
DBHelper.upload_thief_data("Thief_" + str(count), date, time)
DBHelper.upload_thief_data("Thief_1", date, time)
print("An intruder is recorded.")

Binary file not shown.

Binary file not shown.