Performace enhancment
This commit is contained in:
parent
e773fc6a8e
commit
c6c7a80cee
@ -1 +1 @@
|
||||
["", "Hesham", "Saeed"]
|
||||
["", "Hesham", "Aidarous"]
|
8
main.py
8
main.py
@ -47,6 +47,8 @@ def start( camera, face_cascade):
|
||||
rawCapture = PiRGBArray(camera)
|
||||
face_recognizer = cv2.createLBPHFaceRecognizer()
|
||||
face_recognizer.load('faces/m')
|
||||
names = loadNames()
|
||||
print('Known people '+ str(names))
|
||||
while 1:
|
||||
try:
|
||||
camera.capture(rawCapture, format="bgr")
|
||||
@ -62,7 +64,7 @@ def start( camera, face_cascade):
|
||||
j += 1
|
||||
roi_gray = gray[y:y+h, x:x+w]
|
||||
roi_color = img[y:y+h, x:x+w]
|
||||
person = recognize(roi_gray, face_recognizer)
|
||||
person = recognize(roi_gray, face_recognizer, names)
|
||||
if person == 'unknown':
|
||||
print('Found unknown person')
|
||||
else:
|
||||
@ -78,8 +80,8 @@ def start( camera, face_cascade):
|
||||
cv2.destroyAllWindows()
|
||||
break
|
||||
|
||||
def recognize(image,face_recognizer):
|
||||
names = loadNames()
|
||||
def recognize(image,face_recognizer, names):
|
||||
|
||||
try:
|
||||
img = image.copy()
|
||||
label= face_recognizer.predict(img)
|
||||
|
Loading…
Reference in New Issue
Block a user