mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Update face, eye and iris detection scripts.
This commit is contained in:
parent
032a6e3e4d
commit
8d4131426d
@ -34,12 +34,9 @@ while (True):
|
|||||||
img.draw_rectangle(face)
|
img.draw_rectangle(face)
|
||||||
# Now find eyes within each face.
|
# Now find eyes within each face.
|
||||||
# Note: Use a higher threshold here (more detections) and lower scale (to find small objects)
|
# 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:
|
for e in eyes:
|
||||||
e = [face[0]+e[0], face[1]+e[1], e[2], e[3]] # Add face offset
|
|
||||||
img.draw_rectangle(e)
|
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.
|
# Print FPS.
|
||||||
# Note: Actual FPS is higher, streaming the FB makes it slower.
|
# Note: Actual FPS is higher, streaming the FB makes it slower.
|
||||||
|
|||||||
@ -33,9 +33,8 @@ while (True):
|
|||||||
img.draw_rectangle(face)
|
img.draw_rectangle(face)
|
||||||
# Now find eyes within each face.
|
# Now find eyes within each face.
|
||||||
# Note: Use a higher threshold here (more detections) and lower scale (to find small objects)
|
# 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:
|
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)
|
iris = img.find_eyes(e)
|
||||||
img.draw_rectangle(e)
|
img.draw_rectangle(e)
|
||||||
img.draw_cross(iris[0], iris[1])
|
img.draw_cross(iris[0], iris[1])
|
||||||
Loading…
Reference in New Issue
Block a user