From 8d4131426d62664ed7068da7326aeca00c8680a9 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 21 Feb 2016 23:04:31 +0200 Subject: [PATCH] Update face, eye and iris detection scripts. --- usr/examples/face_eye_detection.py | 7 ++----- usr/examples/{eye_detection.py => iris_detection.py} | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) rename usr/examples/{eye_detection.py => iris_detection.py} (93%) diff --git a/usr/examples/face_eye_detection.py b/usr/examples/face_eye_detection.py index 223de05c2..d208d90ab 100644 --- a/usr/examples/face_eye_detection.py +++ b/usr/examples/face_eye_detection.py @@ -34,13 +34,10 @@ while (True): img.draw_rectangle(face) # Now find eyes within each face. # Note: Use a higher threshold here (more detections) and lower scale (to find small objects) - eyes = img.find_features(eyes_cascade, threshold=0.65, scale=1.25, roi=face) + eyes = img.find_features(eyes_cascade, threshold=0.5, scale=1.2, roi=face) for e in eyes: - e = [face[0]+e[0], face[1]+e[1], e[2], e[3]] # Add face offset img.draw_rectangle(e) - # Draw crosshair, add width/2 and height/2 - img.draw_cross(e[0]+int(e[2]/2), e[1]+int(e[3]/2)) - + # Print FPS. # Note: Actual FPS is higher, streaming the FB makes it slower. print(clock.fps()) diff --git a/usr/examples/eye_detection.py b/usr/examples/iris_detection.py similarity index 93% rename from usr/examples/eye_detection.py rename to usr/examples/iris_detection.py index d68584b76..0811b0c4f 100644 --- a/usr/examples/eye_detection.py +++ b/usr/examples/iris_detection.py @@ -33,9 +33,8 @@ while (True): img.draw_rectangle(face) # Now find eyes within each face. # Note: Use a higher threshold here (more detections) and lower scale (to find small objects) - eyes = img.find_features(eyes_cascade, threshold=0.5, scale=1.25, roi=face) + eyes = img.find_features(eyes_cascade, threshold=0.5, scale=1.2, roi=face) for e in eyes: - e = [face[0]+e[0], face[1]+e[1], e[2], e[3]] # Add face offset iris = img.find_eyes(e) img.draw_rectangle(e) img.draw_cross(iris[0], iris[1])