Finalized the code.
15
DBHelper.py
|
@ -117,8 +117,7 @@ def get_motor():
|
||||||
|
|
||||||
# Motor signal setter
|
# Motor signal setter
|
||||||
def set_motor(motor):
|
def set_motor(motor):
|
||||||
data = {"motor": motor}
|
db.child("signal").child("1").child("motor").set(motor)
|
||||||
db.child("signal").child("1").set(data)
|
|
||||||
|
|
||||||
|
|
||||||
# Alarm signal getter
|
# Alarm signal getter
|
||||||
|
@ -129,8 +128,7 @@ def get_alarm():
|
||||||
|
|
||||||
# Alarm signal setter
|
# Alarm signal setter
|
||||||
def set_alarm(alarm):
|
def set_alarm(alarm):
|
||||||
data = {"alarm": alarm}
|
db.child("signal").child("1").child("alarm").set(alarm)
|
||||||
db.child("signal").child("1").set(data)
|
|
||||||
|
|
||||||
|
|
||||||
# Power signal getter
|
# Power signal getter
|
||||||
|
@ -141,8 +139,7 @@ def get_power():
|
||||||
|
|
||||||
# Power signal setter
|
# Power signal setter
|
||||||
def set_power(power):
|
def set_power(power):
|
||||||
data = {"power": power}
|
db.child("signal").child("1").child("power").set(power)
|
||||||
db.child("signal").child("1").set(data)
|
|
||||||
|
|
||||||
|
|
||||||
# Returns the first name or else an empty string.
|
# Returns the first name or else an empty string.
|
||||||
|
@ -176,7 +173,7 @@ def get_signal_address():
|
||||||
|
|
||||||
|
|
||||||
# Uploads the data of user input into firebase.
|
# Uploads the data of user input into firebase.
|
||||||
def upload_signal_data(user_id, firstname, lastname, email, phone, address):
|
def upload_signal_data(firstname, lastname, email, phone, address):
|
||||||
data = {"First Name": firstname, "Last Name": lastname, "E-Mail": email, "Phone": phone, "Address": address}
|
data = {"First Name": firstname, "Last Name": lastname, "E-Mail": email, "Phone": phone, "Address": address}
|
||||||
db.child("signal").child("2").set(data)
|
db.child("signal").child("2").set(data)
|
||||||
|
|
||||||
|
@ -184,3 +181,7 @@ def upload_signal_data(user_id, firstname, lastname, email, phone, address):
|
||||||
# Removes the inputs.
|
# Removes the inputs.
|
||||||
def reset_data():
|
def reset_data():
|
||||||
db.child("signal").child("2").remove()
|
db.child("signal").child("2").remove()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
upload_signal_data("Joe", "Joestar", "Jojo@gmail.com", "6353453242", "JojoLand")
|
|
@ -8,7 +8,7 @@ import Facial_Recognition_Render as fr
|
||||||
import _pickle as cPickle
|
import _pickle as cPickle
|
||||||
import glob
|
import glob
|
||||||
import DBHelper
|
import DBHelper
|
||||||
import Hardware.Updated_HW_codes.NewMotorFunc # Line 225-228
|
import Hardware.Updated_HW_codes.NewMotorFunc # Line 225-228
|
||||||
|
|
||||||
faceWidth = 320
|
faceWidth = 320
|
||||||
faceHeight = 320
|
faceHeight = 320
|
||||||
|
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
18
Main.py
|
@ -1,8 +1,8 @@
|
||||||
import DBHelper
|
import DBHelper
|
||||||
|
|
||||||
import Start_Engine
|
import Start_Engine
|
||||||
import Upload_Face
|
import Upload_Face
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Starting the Program.")
|
print("Starting the Program.")
|
||||||
while True:
|
while True:
|
||||||
|
@ -10,11 +10,11 @@ if __name__ == "__main__":
|
||||||
Start_Engine.start()
|
Start_Engine.start()
|
||||||
|
|
||||||
if None not in (DBHelper.get_signal_firstname(),
|
if None not in (DBHelper.get_signal_firstname(),
|
||||||
DBHelper.get_signal_lastname(),
|
DBHelper.get_signal_lastname(),
|
||||||
DBHelper.get_signal_email(),
|
DBHelper.get_signal_email(),
|
||||||
DBHelper.get_signal_phone(),
|
DBHelper.get_signal_phone(),
|
||||||
DBHelper.get_signal_address()):
|
DBHelper.get_signal_address()):
|
||||||
Upload_Face.upload_your_face(DBHelper.get_signal_firstname(), DBHelper.get_signal_lastname(),
|
Upload_Face.upload_your_face(DBHelper.get_signal_firstname(), DBHelper.get_signal_lastname(),
|
||||||
DBHelper.get_signal_email(), DBHelper.get_signal_phone(),
|
DBHelper.get_signal_email(), DBHelper.get_signal_phone(),
|
||||||
DBHelper.get_signal_address())
|
DBHelper.get_signal_address())
|
||||||
DBHelper.reset_data()
|
DBHelper.reset_data()
|
||||||
|
|
|
@ -6,9 +6,9 @@ def upload_your_face(firstname, lastname, email, phone, address):
|
||||||
# Determines user ID before adding the data to the database.
|
# Determines user ID before adding the data to the database.
|
||||||
# User ID is determined from number of user dataset in database
|
# User ID is determined from number of user dataset in database
|
||||||
# Later on it starts face recognition system and uploads it into the database based on the given user ID.
|
# Later on it starts face recognition system and uploads it into the database based on the given user ID.
|
||||||
count = 0
|
|
||||||
users = DBHelper.db.child("Users").get()
|
users = DBHelper.db.child("Users").get()
|
||||||
try:
|
try:
|
||||||
|
count = 1
|
||||||
for user in users.each():
|
for user in users.each():
|
||||||
count += 1
|
count += 1
|
||||||
DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone, address)
|
DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone, address)
|
||||||
|
|
|
@ -6,11 +6,11 @@ import Facial_Recognition_Wrapper
|
||||||
def start():
|
def start():
|
||||||
# Downloads all the user and thief photos from database to the project folder first or updates them.
|
# Downloads all the user and thief photos from database to the project folder first or updates them.
|
||||||
# Then it starts Facial Recognition Software.
|
# Then it starts Facial Recognition Software.
|
||||||
count = 0
|
|
||||||
users = DBHelper.db.child("Users").get()
|
users = DBHelper.db.child("Users").get()
|
||||||
thieves = DBHelper.db.child("Thieves").get()
|
thieves = DBHelper.db.child("Thieves").get()
|
||||||
print("Checking and updating User photos...")
|
print("Checking and updating User photos...")
|
||||||
try:
|
try:
|
||||||
|
count = 0
|
||||||
for user in users.each():
|
for user in users.each():
|
||||||
count += 1
|
count += 1
|
||||||
if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count)):
|
if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count)):
|
||||||
|
|