Quantcast
Channel: Support - Pimoroni Buccaneers
Viewing all articles
Browse latest Browse all 6856

Pan-Tilt Hat Roaming

$
0
0

@RaspberryPicardBox wrote:

Hi there,
I recently got the cute little pan-tilt hat and started messing around with the face tracking examples.
They work great, but I'd like the module to 'roam' per say when it cannot find a face - to this end, I've modified the 'facetracker_lbp.py' program with partial success.

I added this if statement just before the for loop:

lights(50 if len(faces) == 0 else 0, 50 if len(faces) > 0 else 0,0,50)

if len(faces) == 0:
roam()

for (x, y, w, h) in faces:

and defined 'roam' earlier on in the program (before the while True loop):

def roam():
rand_x = random.randint(-20,20)
rand_y = random.randint(-20,20)
pan(rand_x)
time.sleep(2)
tilt(rand_y)
time.sleep(2)

The roaming aspect works fine, but the sleep commands lock up the program every time it tries to refresh the frame in order to detect a face, resulting in a dreadfully slow frame rate and an unusable video output. Does anyone have any ideas on how to preserve the roaming function and the face tracking?
Thanks in advance!

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6856

Trending Articles