https://github.com/ayotomi-de/focuscam
FocusCam is a lightweight desktop app that uses your webcam to track focus by detecting facial landmarks and eye visibility. Itβs your mini assistant to know when you're not paying attention. π
https://github.com/ayotomi-de/focuscam
distraction face-detection haar-cascade mediapipe mysql object-detection opencv pillow python tkinter-gui
Last synced: 3 months ago
JSON representation
FocusCam is a lightweight desktop app that uses your webcam to track focus by detecting facial landmarks and eye visibility. Itβs your mini assistant to know when you're not paying attention. π
- Host: GitHub
- URL: https://github.com/ayotomi-de/focuscam
- Owner: Ayotomi-de
- Created: 2025-06-27T10:00:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-26T22:14:45.000Z (11 months ago)
- Last Synced: 2025-07-27T01:23:33.899Z (11 months ago)
- Topics: distraction, face-detection, haar-cascade, mediapipe, mysql, object-detection, opencv, pillow, python, tkinter-gui
- Language: Python
- Homepage:
- Size: 207 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π― FocusCam: Distraction Detection App
FocusCam is a lightweight desktop app that uses your webcam to track focus by detecting facial landmarks and eye visibility. Built with **OpenCV**, **MediaPipe**, and **Tkinter**, itβs your mini assistant to know when you're not paying attention.
## Features
- Real-time face & eye detection using MediaPipe FaceMesh.
- Logs moments of distraction to a CSV file.
- Simple and clean GUI using Tkinter.
- Real-time video display using your webcam.
- Beginner-friendly codebase to learn from.
- Designed with students and focus-lovers in mind.
## π§ What Iβm Learning
This is my first full solo computer vision project after lots of tutorials!
I'm learning to:
- Use GUI frameworks (like Tkinter)
- Integrate MediaPipe for face & eye tracking
- Build real-time applications
- Handle logic for motion/distraction detection
- Log events to external files
- Debug Python library issues
- Save photos to database.
## π» Tech Stack
- Python
- OpenCV
- MediaPipe
- Tkinter
- PIL (Pillow)
- CSV Logging
- MySQL
## π οΈ How to Run
1. Clone this repo
`git clone https://github.com//FocusCam.git`
2. Install dependencies
`pip install opencv-python mediapipe Pillow`
3. Run the app
`python focuscam.py`
| Error | Fix |
| -------------------------------------- | ------------------------------------------------------------ |
| `OSError: could not get source code` | MediaPipe doesnβt support Python 3.12 β I downgraded to 3.10 |
| Haarcascade not detecting eyes | Switched to MediaPipe FaceMesh for better accuracy |
## π Project Files
- `focuscam.py` β Main app file
- `distraction_log.csv` β Log file for distractions
- `README.md` β This doc
- `haarcascade_frontalface_default.xml` β (Optional backup if you use it)
- `haarcascade_eye.xml`
- `database.py` - Mysql database connection code
- `test_db_connection` - To test if Mysql runs smoothly
- `focuscam.sql` - The SQL query of the Mysql databse which I created in phpMyAdmin using XAMPP.
- `banner.png` - (Coming soon: project thumbnail!)
## Planned Improvements
- [x] Real-time face detection using FaceMesh
- [x] Distraction logging to CSV
- [x] Start/Stop detection button
- [x] Clean exit button
- [x] Saving users faces and username in a Mysql database
- [x] Storing users info in a Mysql
- [x] Notification system (e.g. sound or pop-up)
- [ ] Face recognition
- [ ] Export logs as summary report (particluarly as pdf files)
## Planned Updates and Upcoming Changes
After some deep thinking, i've decided to change focuscam to something else that can be implemented in the real-word usage, it can be a whole different logic or maybe a web app, who knows? However, I'll continue working on the logic of focuscam so stay tunded π.
## Let's Connect
π©π½βπ» About Me
Hi, Iβm **Ayotomide** β a passionate learner, tech enthusiast, and now a proud builder of FocusCam!
This project is part of my journey into computer vision and software engineering.
Got ideas? Want to contribute or learn together? Letβs connect:
π§ [My email](mailto:ayotomide.toluwani@gmail.com)
π¦ [Ayotomide Ogunsami](www.linkedin.com/in/ayotomide-ogunsami-93aa61312)
> βFocus is the key to finishing. Let your camera catch what your brain might miss.β