I'm new to coding so please forgive if this is simple... I am working on a raspberry pi python script and I am struggling to get the if statement to do what I want.
I can count fingers on a hand in a video stream and this is working fine.
Next I want to initiate a first event (beep) when 5 fingers (defects) are counted, and then proceed into a sub loop where if the 5 fingers subsequently change to zero fingers within a given time (2s) then another second event (click) happens.
this is what I have so far (not quite working):
if count_defects==5:
os.system('mpg321 beep.mp3 -q')
time.sleep(2)
if count_defects<5:
os.system('mpg321 click.mp3 -q')
else:
cv2.putText(img, "Waiting", (50,50), font, 1, (255,255,255), 1)
Hope someone can help thanks
Aucun commentaire:
Enregistrer un commentaire