merge #5

Merged
Hesham merged 8 commits from screen-shot-mod into master 2018-12-04 18:55:02 +01:00
Showing only changes of commit e773fc6a8e - Show all commits

View File

@ -45,6 +45,8 @@ def init():
def start( camera, face_cascade): def start( camera, face_cascade):
j = 0 j = 0
rawCapture = PiRGBArray(camera) rawCapture = PiRGBArray(camera)
face_recognizer = cv2.createLBPHFaceRecognizer()
face_recognizer.load('faces/m')
while 1: while 1:
try: try:
camera.capture(rawCapture, format="bgr") camera.capture(rawCapture, format="bgr")
@ -60,7 +62,7 @@ def start( camera, face_cascade):
j += 1 j += 1
roi_gray = gray[y:y+h, x:x+w] roi_gray = gray[y:y+h, x:x+w]
roi_color = img[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w]
person = recognize(roi_gray) person = recognize(roi_gray, face_recognizer)
if person == 'unknown': if person == 'unknown':
print('Found unknown person') print('Found unknown person')
else: else:
@ -76,11 +78,9 @@ def start( camera, face_cascade):
cv2.destroyAllWindows() cv2.destroyAllWindows()
break break
def recognize(image): def recognize(image,face_recognizer):
names = loadNames() names = loadNames()
try: try:
face_recognizer = cv2.createLBPHFaceRecognizer()
face_recognizer.load('faces/m')
img = image.copy() img = image.copy()
label= face_recognizer.predict(img) label= face_recognizer.predict(img)
except: except: