This project is a real-time face tracking system that uses Python and OpenCV for face detection and Arduino for camera movement. The system captures a video feed, detects faces, and moves a camera accordingly using servo motors.
- Real-time face detection using OpenCV's Haar Cascade Classifier
- Serial communication between Python and Arduino
- Camera movement using servo motors based on face position
- Adjustable sensitivity and movement parameters
- Arduino UNO
- 2x Servo Motors (e.g., Tower Pro SG90)
- Web Camera
- Python & OpenCV libraries
- Haar Cascade file for face detection
Make sure you have Python installed. Then, install the required libraries:
pip install opencv-python pyserial numpyUpload the Arduino sketch (Cameracontol.ino) to your Arduino board using the Arduino IDE.
Place the haarcascade_frontalface_default.xml file in the same directory as main.py and run the script:
python main.py- The webcam captures video frames.
- OpenCV detects faces in real-time.
- The Python script sends position commands (
L,R,U,D,S) to the Arduino over a serial connection. - The Arduino moves the servos to adjust the camera's orientation.
- Reads frames from the webcam.
- Converts frames to grayscale.
- Detects faces and determines their position.
- Sends movement commands (
L,R,U,D) to Arduino based on face position.
- Receives commands from Python via serial communication.
- Controls servo motors to adjust camera direction.
- Implementing deep learning-based face tracking for better accuracy.
- Adding support for multiple face tracking.
- Using a pan-tilt camera module for smoother movement.
Developed by Mohamed Bouchenti. Contributions and suggestions are welcome!