Skip to content

This Python program uses Mediapipe and OpenCV to detect a smile by measuring the distance between mouth landmarks. When the smile is wide enough, it captures a selfie and plays a sound. It runs in real time via webcam and stops when the Esc key is pressed.

License

Notifications You must be signed in to change notification settings

Aaryafalle/Automatic_smile_capture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✅ Prerequisites Before running the program, make sure the following Python libraries are installed:

pip install opencv-python

pip install mediapipe

If you're using sound alerts (like BAK.wav), also ensure you're on Windows, since the winsound module is built-in for Windows only.

You’ll also need: A working webcam

Python 3.7 or higher

Automatic_smile_capture

📸 Smile-Based Selfie Capture – How It Works This Python program uses your webcam and Mediapipe's FaceMesh to detect your face in real time. It tracks two specific landmark points on the corners of your mouth — points 61 (left) and 291 (right).

🧠 Facial Landmarks Detection:

Mediapipe scans your face and finds 468 facial landmarks.

Landmark 61 is on the left corner of the mouth, and 291 is on the right corner.

When you smile, this distance increases, because your mouth stretches wider.

📸 Automatic Selfie & Sound:

If the distance crosses a certain threshold (e.g., 70 pixels), it means you're smiling.

The program saves a photo and plays a sound (BAK.wav) to notify you.

🔁 Runs Continuously:

It keeps checking for your smile in real time.

You can press Esc to exit the program.

About

This Python program uses Mediapipe and OpenCV to detect a smile by measuring the distance between mouth landmarks. When the smile is wide enough, it captures a selfie and plays a sound. It runs in real time via webcam and stops when the Esc key is pressed.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages