/face_detection.py Secret
Last active
August 9, 2023 06:24
Star
You must be signed in to star a gist
Copied from https://github.com/hktan125/CircuitPython-HuskyLens/blob/main/Examples/face_detection.py.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import board | |
import time | |
import neopixel | |
from circuitPyHuskyLib import HuskyLensLibrary | |
hl = HuskyLensLibrary('UART', TX=board.GP8, RX=board.GP9) | |
hl.algorithm("ALGORITHM_FACE_RECOGNITION") # Redirect to Face Recognition Function | |
pixel = neopixel.NeoPixel(board.GP28, 1) | |
# Colors (r,g,b) | |
OFF = (0,0,0) | |
ON = (30,30,30) | |
while True: | |
results = hl.blocks() # Get All type=BLOCK result | |
if results: # if result not empty | |
print(f"Detected face count: {len(results)}") | |
pixel.fill(ON) | |
else: | |
pixel.fill(OFF) | |
pixel.show() | |
time.sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copied from https://github.com/hktan125/CircuitPython-HuskyLens/blob/main/Examples/face_detection.py.
Wanted to use the embed function in Gist.
My note:
https://www.cytron.io/tutorial/face-detection-using-huskylens