This Python project uses OpenCV to capture selfies automatically when it detects a smiling face in the camera frame. It provides a fun and interactive way to take pictures with just a smile!
- Detects faces and smiles in real-time using OpenCV.
- Captures selfies when a smiling face is detected.
- Saves selfies with timestamps in PNG format.
- Simple and interactive.
Before you begin, ensure you have met the following requirements:
- Python (version 3.x recommended)
- OpenCV (
pip install opencv-python
) - Haar cascades for face and smile detection (
haarcascade_frontalface_default.xml
andhaarcascade_smile.xml
)
- Clone the repository:
git clone https://github.com/sid-lakhani/auto-selfie.git cd auto-selfie
- Install the required Python packages:
pip install opencv-python
- Download the Haarcascade XML files for face and smile detection and place them in the project directory.
- Run the script:
python main.py
- Start the script – Launch the program by running:
python main.py
- Smile at the camera – The program continuously detects faces and smiles in real time.
- Selfie Capture – As soon as a smile is detected, the selfie is automatically taken.
- Save & View – The image is saved in the project directory with a timestamp.
- Exit the program – To close the camera and stop the script, press the
q
key.
- Pose Estimation – Integrate pose detection to capture selfies only when a user strikes a specific pose.
- Gesture-Based Capture – Allow users to trigger selfies using hand gestures instead of just smiles.
- AI-Based Image Enhancement – Apply AI-powered enhancements like automatic brightness correction and noise reduction.
- Multi-Person Smart Framing – Automatically adjust the frame and focus based on the number of people in view.
Contributions are welcome! Here’s how you can contribute:
- Fork the repository on GitHub.
- Create a new branch (
git checkout -b feature-name
). - Make your changes and commit (
git commit -m "Add new feature"
). - Push to GitHub (
git push origin feature-name
). - Open a pull request to merge your changes.
This project is licensed under the MIT License – see the LICENSE file for details.