I am looking for Knowledge.
I'm new to python and need to do a project with a camera Gravity: HuskyLens. It allows you to display blocks when it detects faces (around the face, it's tracking in summary) And I would like, when I detect a Block, to know if it is detected for more than 7 seconds.
import time
import json
from huskylib import HuskyLensLibrary
# Initialize
#hl = HuskyLensLibrary("I2C", "", address = 0x32)
hl = HuskyLensLibrary("SERIAL", "/dev/ttyUSB0", 3000000)
# Change to face recognition algorithms
hl.algorithms("ALGORITHM_FACE_RECOGNITION")
timer = time.time()
while True:
blocks = hl.requestAll()
for block in blocks:
if block.type == "BLOCK": # If a block is detected
print("Face !")
if BLOCK DETECTED MORE THAN 7 SECONDS: # If a block is detected more than 7 seconds
print("SCREAMER ! BOO !")
time.sleep(0.5)
else:
print("No Face !")
time.sleep(0.5)
I do not know if it is sufficiently clear, I am interested in any information allowing me to progress
ps: I have already gone for a walk on the Time library but I have not managed to understand everything and therefore find my happiness.