Update example

This commit is contained in:
iabdalkader 2014-10-01 02:03:55 +02:00
parent d94e318dbe
commit 6fd70bb734

View File

@ -1,19 +1,24 @@
import sensor, time import sensor, time
sensor.reset()
# Set sensor brightness
sensor.set_contrast(1)
# Set sensor gainceiling # Set sensor gainceiling
sensor.set_gainceiling(16) sensor.set_gainceiling(16)
# Set sensor brightness # Set framesize
sensor.set_brightness(-2) sensor.set_framesize(sensor.QCIF)
# Set sensor to grayscale # Set sensor to grayscale
sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE)
# Load Haar Cascade # Load Haar Cascade
cascade = HaarCascade("0:/frontalface_default.cascade") face_cascade = HaarCascade("/frontalface.cascade")
print(cascade) print(face_cascade)
clock = time.clock() clock = time.clock()
while (True): while (True):
clock.tick() clock.tick()
image = sensor.snapshot() image = sensor.snapshot()
objects = image.find_features(cascade) objects = image.find_features(face_cascade, threshold=0.65, scale=1.65)
for r in objects: for r in objects:
image.draw_rectangle(r) image.draw_rectangle(r)
#Add delay to see drawing on FB
time.sleep(10)
print (clock.fps()) print (clock.fps())