face detection doorcam using opencv
june 2022
overview
This project started because I kept missing my doorbell. So I decided to turn an old smartphone into a smart door camera that plays a bell sound on a remote speaker whenever it detects a human face.
The setup runs locally using Python and OpenCV — it captures video from the phone's camera, detects faces in real time, and triggers a sound alert when someone shows up at the door. The code runs right on Termux on an old Redmi phone, no server or internet needed.
how it works
The script uses OpenCV's CascadeClassifier with the haarcascade_frontalface_default.xml model to detect faces in every frame. Each detected face is highlighted with a rectangle, and a short bell sound plays instantly. The app keeps running until manually closed, making it a light, DIY smart doorbell setup.
requirements
opencv-python– for computer vision tasksopencv-python-headless– for headless environments (optional)
future additions
- Adding a "leave a message" feature when no one answers
- Possibly integrating cloud notifications or local WiFi alerts
file structure
face_detection/
├── detect_face.py
├── haarcascade_frontalface_default.xml
└── README.md