mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
scripts/examples: Fix Haar Cascade Paths.
This commit is contained in:
parent
8069b2a966
commit
de2bea26e9
@ -27,7 +27,7 @@ led = machine.LED("LED_RED")
|
||||
# HaarCascade are loaded. However, You can adjust the number of stages to speed
|
||||
# up processing at the expense of accuracy. The frontalface HaarCascade has 25
|
||||
# stages.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
|
||||
while True:
|
||||
print("About to start detecting faces...")
|
||||
|
@ -33,7 +33,7 @@ led = machine.LED("LED_RED")
|
||||
# HaarCascade are loaded. However, You can adjust the number of stages to speed
|
||||
# up processing at the expense of accuracy. The frontalface HaarCascade has 25
|
||||
# stages.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
|
||||
while True:
|
||||
print("About to start detecting faces...")
|
||||
|
@ -11,7 +11,7 @@
|
||||
import image
|
||||
import time
|
||||
|
||||
stream = image.ImageIO("/stream.bin", "r")
|
||||
stream = image.ImageIO("stream.bin", "r")
|
||||
|
||||
clock = time.clock() # Create a clock object to track the FPS.
|
||||
while True:
|
||||
|
@ -23,7 +23,7 @@ sensor.skip_frames(time=2000) # Wait for settings take effect.
|
||||
clock = time.clock() # Create a clock object to track the FPS.
|
||||
|
||||
led = machine.LED("LED_RED")
|
||||
stream = image.ImageIO("/stream.bin", "w")
|
||||
stream = image.ImageIO("stream.bin", "w")
|
||||
|
||||
# Red LED on means we are capturing frames.
|
||||
led.on()
|
||||
|
@ -34,7 +34,7 @@ led = machine.LED("LED_RED")
|
||||
# HaarCascade are loaded. However, You can adjust the number of stages to speed
|
||||
# up processing at the expense of accuracy. The frontalface HaarCascade has 25
|
||||
# stages.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
|
||||
while True:
|
||||
print("About to start detecting faces...")
|
||||
|
@ -10,7 +10,7 @@ import image
|
||||
import time
|
||||
|
||||
# Load image
|
||||
img = image.Image("/example.bmp", copy_to_fb=True)
|
||||
img = image.Image("example.bmp", copy_to_fb=True)
|
||||
|
||||
# Add a small delay to allow the IDE to read the loaded image.
|
||||
time.sleep_ms(1000)
|
||||
|
@ -31,7 +31,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
# Load Haar Cascade
|
||||
# By default this will use all stages, lower satges is faster but less accurate.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
print(face_cascade)
|
||||
|
||||
# FPS clock
|
||||
|
@ -23,8 +23,8 @@ sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
# Load Haar Cascade
|
||||
# By default this will use all stages, lower satges is faster but less accurate.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
eyes_cascade = image.HaarCascade("eye", stages=24)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
eyes_cascade = image.HaarCascade("/rom/haarcascade_eye.cascade", stages=24)
|
||||
print(face_cascade, eyes_cascade)
|
||||
|
||||
# FPS clock
|
||||
|
@ -26,7 +26,7 @@ sensor.skip_frames(time=2000)
|
||||
|
||||
# Load Haar Cascade
|
||||
# By default this will use all stages, lower satges is faster but less accurate.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
print(face_cascade)
|
||||
|
||||
# First set of keypoints
|
||||
|
@ -32,7 +32,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
# Load Haar Cascade
|
||||
# By default this will use all stages, lower stages is faster but less accurate.
|
||||
eyes_cascade = image.HaarCascade("eye", stages=24)
|
||||
eyes_cascade = image.HaarCascade("/rom/haarcascade_eye.cascade", stages=24)
|
||||
print(eyes_cascade)
|
||||
|
||||
# FPS clock
|
||||
|
@ -27,7 +27,7 @@ while True:
|
||||
img.find_hog()
|
||||
|
||||
# Uncomment to save raw FB to file and exit the loop
|
||||
# img.save("/hog.pgm")
|
||||
# img.save("hog.pgm")
|
||||
# break
|
||||
|
||||
print(clock.fps())
|
||||
|
@ -34,7 +34,7 @@ def draw_keypoints(img, kpts):
|
||||
|
||||
kpts1 = None
|
||||
# NOTE: uncomment to load a keypoints descriptor from file
|
||||
# kpts1 = image.load_descriptor("/desc.orb")
|
||||
# kpts1 = image.load_descriptor("desc.orb")
|
||||
# img = sensor.snapshot()
|
||||
# draw_keypoints(img, kpts1)
|
||||
|
||||
|
@ -26,7 +26,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
# Load Haar Cascade
|
||||
# By default this will use all stages, lower satges is faster but less accurate.
|
||||
face_cascade = image.HaarCascade("frontalface", stages=25)
|
||||
face_cascade = image.HaarCascade("/rom/haarcascade_frontalface.cascade", stages=25)
|
||||
print(face_cascade)
|
||||
|
||||
# Skip a few frames to allow the sensor settle down
|
||||
@ -36,7 +36,7 @@ for i in range(0, 30):
|
||||
img.draw_string(0, 0, "Please wait...")
|
||||
|
||||
d0 = None
|
||||
# d0 = image.load_descriptor("/desc.lbp")
|
||||
# d0 = image.load_descriptor("desc.lbp")
|
||||
clock = time.clock()
|
||||
|
||||
while True:
|
||||
|
@ -33,7 +33,7 @@ sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
# Load template.
|
||||
# Template should be a small (eg. 32x32 pixels) grayscale image.
|
||||
template = image.Image("/template.pgm")
|
||||
template = image.Image("template.pgm")
|
||||
|
||||
clock = time.clock()
|
||||
|
||||
|
@ -123,7 +123,7 @@ def face_detection(data):
|
||||
faces = (
|
||||
sensor.snapshot()
|
||||
.gamma_corr(contrast=1.5)
|
||||
.find_features(image.HaarCascade("frontalface"))
|
||||
.find_features(image.HaarCascade("/rom/haarcascade_frontalface.cascade"))
|
||||
)
|
||||
if not faces:
|
||||
return bytes() # No detections.
|
||||
|
Loading…
Reference in New Issue
Block a user