This project collects sample scripts using MediaPipe and OpenCV
for real-time image analysis such as face detection, Face Mesh, hand tracking, pose detection, and face recognition. They can run on a Raspberry Pi 5 at about 15–25 FPS.
You should install Python 3 and then install the libraries listed in requirements.txt
with the command:
pip install -r requirements.txt
face-detect.py
– face detection scriptface-mesh.py
– draw Face Mesh points with FPS counterhand-tracking.py
– detect and track handspose-detect.py
– detect body posesface_registration/
– face recognition and attendance systemface-recognition.py
– face recognition using features from Face Meshface_recognition_ui.py
– GUI for face recognitionattendance.py
– face recognition for logging employee check‑in/out timesfaces/
– sample images for building face vectors used for recognition Inside this folder create a subfolder for each person, e.g.faces/person-name/
Add several face images of that person (supports.jpg
or.png
) before runningface-recognition.py
Iffaces/
does not exist, create it first withmkdir faces
Run the desired script using commands like:
python face-detect.py
python face-mesh.py
python hand-tracking.py
python pose-detect.py
python face_registration/face-recognition.py
python face_registration/face_recognition_ui.py
python face_registration/attendance.py
Before running face_registration/face_recognition_ui.py
, install Pillow
(for example, with pip install Pillow
) and verify that face_registration/face_recognition_processor.py
is present in the project.
While running face_registration/face-recognition.py
, press n
to capture and register a new face. The image will be saved and the face_registration/faces/
folder will be updated automatically.
For face_registration/face-recognition.py
you can adjust the cosine similarity threshold used for matching by either setting the environment variable COSINE_THRESHOLD
or passing the command-line option --threshold
, for example:
COSINE_THRESHOLD=0.9 python face_registration/face-recognition.py
# or
python face_registration/face-recognition.py --threshold 0.9
Press q
to close each program's display window.
These scripts are intended for experimentation or studying MediaPipe. Users can adjust parameters within each script to suit their own tasks.