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)
|
rawCapture = PiRGBArray(camera)
|
||||||
face_recognizer = cv2.createLBPHFaceRecognizer()
|
face_recognizer = cv2.createLBPHFaceRecognizer()
|
||||||
face_recognizer.load('faces/m')
|
face_recognizer.load('faces/m')
|
||||||
|
names = loadNames()
|
||||||
|
print('Known people '+ str(names))
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
camera.capture(rawCapture, format="bgr")
|
camera.capture(rawCapture, format="bgr")
|
||||||
@ -62,7 +64,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, face_recognizer)
|
person = recognize(roi_gray, face_recognizer, names)
|
||||||
if person == 'unknown':
|
if person == 'unknown':
|
||||||
print('Found unknown person')
|
print('Found unknown person')
|
||||||
else:
|
else:
|
||||||
@ -78,8 +80,8 @@ def start( camera, face_cascade):
|
|||||||
cv2.destroyAllWindows()
|
cv2.destroyAllWindows()
|
||||||
break
|
break
|
||||||
|
|
||||||
def recognize(image,face_recognizer):
|
def recognize(image,face_recognizer, names):
|
||||||
names = loadNames()
|
|
||||||
try:
|
try:
|
||||||
img = image.copy()
|
img = image.copy()
|
||||||
label= face_recognizer.predict(img)
|
label= face_recognizer.predict(img)
|
||||||
|
Loading…
Reference in New Issue
Block a user