Fixed the face removal.
This commit is contained in:
parent
c654b33941
commit
68b0e75db2
4 changed files with 10 additions and 16 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,5 @@
|
|||
import DBHelper
|
||||
import os
|
||||
import shutil
|
||||
import Facial_Recognition_Enrollment
|
||||
|
||||
|
||||
def remove_your_face(firstname, lastname, email, phone):
|
||||
|
@ -24,36 +22,31 @@ def remove_your_face(firstname, lastname, email, phone):
|
|||
break
|
||||
print("Reorganizing the Users... (This may take long time.)")
|
||||
if count2 != count and count - count2 - 1 != 0:
|
||||
for x in range(count - count2 - 1):
|
||||
DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_lastname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_email("User_" + str(count2 + 1)),
|
||||
DBHelper.get_phone("User_" + str(count2 + 1)))
|
||||
if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count2)):
|
||||
os.makedirs("Facial_images/face_rec/train/User_" + str(count2))
|
||||
for x in range(count - count2):
|
||||
for i in range(50):
|
||||
DBHelper.download_user_photo_other("User_" + str(count2 + 1) + "/" + str(i) + ".jpg",
|
||||
"User_" + str(count2) + "/" + str(i) + ".jpg")
|
||||
DBHelper.upload_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
|
||||
DBHelper.delete_user_photo("User_" + str(count2 + 1) + "/" + str(i) + ".jpg")
|
||||
DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_lastname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_email("User_" + str(count2 + 1)),
|
||||
DBHelper.get_phone("User_" + str(count2 + 1)))
|
||||
count2 += 1
|
||||
DBHelper.remove_data("User_" + str(count))
|
||||
shutil.rmtree("Facial_images/face_rec/train/User_" + str(count))
|
||||
elif count2 != count and count - count2 - 1 == 0:
|
||||
DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_lastname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_email("User_" + str(count2 + 1)),
|
||||
DBHelper.get_phone("User_" + str(count2 + 1)))
|
||||
if not os.path.isdir("Facial_images/face_rec/train/User_" + str(count2)):
|
||||
os.makedirs("Facial_images/face_rec/train/User_" + str(count2))
|
||||
for i in range(50):
|
||||
DBHelper.download_user_photo_other("User_" + str(count2 + 1) + "/" + str(i) + ".jpg",
|
||||
"User_" + str(count2) + "/" + str(i) + ".jpg")
|
||||
DBHelper.upload_user_photo("User_" + str(count2) + "/" + str(i) + ".jpg")
|
||||
DBHelper.delete_user_photo("User_" + str(count2 + 1) + "/" + str(i) + ".jpg")
|
||||
DBHelper.upload_data("User_" + str(count2), DBHelper.get_firstname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_lastname("User_" + str(count2 + 1)),
|
||||
DBHelper.get_email("User_" + str(count2 + 1)),
|
||||
DBHelper.get_phone("User_" + str(count2 + 1)))
|
||||
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.")
|
||||
|
@ -65,3 +58,4 @@ if __name__ == "__main__":
|
|||
e = input('Enter your E-Mail:')
|
||||
p = input('Enter your Phone:')
|
||||
remove_your_face(f, l, e, p)
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue