Thanks to visit codestin.com
Credit goes to github.com

Skip to content

QAInsights/kan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‘๏ธ Kan - Eye Health Monitor

Kan (เฎ•เฎฃเฏ) means "Eye" in Tamil

After the setup is done; no need to do anything, just blink * n

Protect your vision in the digital age. Kan is an intelligent eye health monitoring application that tracks your blink rate in real-time, provides health insights, and helps prevent digital eye strain through continuous background monitoring.

Python 3.11+ MediaPipe License: MIT

๐ŸŽฏ Problem Statement

In today's digital world, people spend 8-12 hours daily staring at screens, leading to:

  • ๐Ÿ’ป Digital Eye Strain affecting 60% of computer users
  • ๐Ÿ˜“ Reduced Blink Rate (from 15-20 to 5-7 blinks/minute)
  • ๐Ÿฅ Computer Vision Syndrome with symptoms like dry eyes, headaches, and blurred vision
  • โš ๏ธ Long-term Vision Problems from prolonged screen exposure

๐Ÿ’ก Our Solution

Kan is a non-intrusive desktop and web application that:

  1. โœ… Monitors your blink rate continuously in the background
  2. โœ… Analyzes your eye health patterns using medical research
  3. โœ… Alerts you when issues are detected
  4. โœ… Guides you with personalized recommendations
  5. โœ… Tracks your progress over time with detailed analytics

๐Ÿ“ท Screenshots

System Tray Tracker Settings EyeTips

โœจ Key Features

๐Ÿ”ฌ Advanced Detection Technology

  • MediaPipe Face Mesh - Google's state-of-the-art 468-point facial landmark detection
  • Adaptive Thresholding - Learns your unique blink pattern
  • Glasses Mode - Optimized detection for eyewear users
  • Real-time Processing - 30 FPS with minimal CPU usage
  • High Accuracy - Eye Aspect Ratio (EAR) algorithm with 95%+ accuracy

๐ŸŽ›๏ธ Smart Features

  • Background Operation - Runs silently in system tray
  • Desktop Notifications - Automatic health alerts every 30 seconds
  • Adaptive Learning - Adjusts to your baseline blink rate
  • Medical Insights - Research-based health recommendations
  • Privacy First - All data stored locally, no cloud sync

๐Ÿ“Š Comprehensive Dashboard

  • Real-time Statistics - Live blink counter, BPM, session duration
  • Interactive Charts - Weekly trends and hourly patterns
  • Health Insights - Color-coded alerts (Normal, Warning, Critical)
  • Customizable Settings - Adjust sensitivity and detection parameters
  • Session History - Track your progress over time

๐ŸŽจ Beautiful UI

  • Intuitive Design - Modern, clean interface
  • Responsive Layout - Works on any screen size
  • Smooth Animations - Polished user experience

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+ (recommended)
  • Webcam (built-in or external)
  • Windows 10/11
  • 2GB RAM minimum

One-Command Installation

# Clone the repository
git clone https://github.com/QAInsights/kan.git
cd kan

# Create virtual environment
python -m venv venv
venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Run the application
python run_app.py

What Happens Next?

  1. ๐ŸŒ Web dashboard opens automatically at http://localhost:5000
  2. ๐Ÿ‘๏ธ System tray icon appears in bottom-right corner
  3. ๐Ÿ“น Camera access requested (allow for detection)
  4. โœ… Ready to track! Click "Start Tracking" in dashboard

๐Ÿ“ฑ How to Use Kan

1๏ธโƒฃ System Tray (Background Monitoring)

Find the eye icon ๐Ÿ‘๏ธ in your system tray (bottom-right corner):

Hover to see:

Kan [TRACKING] | Blinks: 42 | BPM: 15.2 | Time: 00:15:32

Right-click menu:

  • ๐Ÿ“Š Live Stats - Blinks, BPM, Duration
  • โ–ถ๏ธ Start Tracking - Begin monitoring
  • โธ๏ธ Pause Tracking - Temporary pause
  • โน๏ธ Stop Tracking - End session
  • ๐ŸŒ Open Dashboard - Full interface
  • โŒ Exit - Close application

2๏ธโƒฃ Web Dashboard (Full Control)

Access: http://localhost:5000

Features:

  • ๐Ÿ“ˆ Real-time stats updating every second
  • ๐ŸŽ›๏ธ Adjustable settings (EAR threshold, glasses mode)
  • ๐Ÿ“Š Beautiful charts (weekly trends, hourly patterns)
  • ๐Ÿ’ก Health insights with medical recommendations
  • ๐ŸŽฅ Camera selection and configuration

3๏ธโƒฃ Health Monitoring

Automatic Alerts:

โš ๏ธ Reduced Blink Rate Detected

Your blink rate is 9.2 per minute,
below normal (12-20 BPM).

Top recommendations:
โ€ข Take a 20-second break
โ€ข Blink consciously

Health Levels:

  • ๐ŸŸข Normal (12-20 BPM) - Healthy blink rate
  • ๐ŸŸก Warning (8-12 BPM) - Slightly reduced
  • ๐Ÿ”ด Critical (<8 BPM) - Severely reduced

4๏ธโƒฃ Customizable Settings

Detection Settings:

  • EAR Threshold (0.15-0.35) - Adjust sensitivity
  • Consecutive Frames (1-5) - Blink confirmation
  • ๐Ÿ‘“ Glasses Mode - Enhanced detection for eyewear
  • Debug Mode - View detailed logs
  • Show Landmarks - Visual feedback

๐Ÿ—๏ธ Technical Architecture

Technology Stack

Frontend:

  • HTML5, CSS3, JavaScript (ES6+)
  • Bootstrap 5 - Responsive UI framework
  • Chart.js - Interactive data visualization
  • Socket.IO - Real-time updates

Backend:

  • Python 3.11 - Core application
  • Flask - Web server
  • MediaPipe - Face mesh detection
  • OpenCV - Camera management
  • SQLite - Local database

Desktop Integration:

  • pystray - System tray icon
  • plyer - Desktop notifications
  • Threading - Background processing

Detection Algorithm

Eye Aspect Ratio (EAR):

EAR = (||p2-p6|| + ||p3-p5||) / (2 * ||p1-p4||)

Where p1-p6 are eye landmark points
Blink detected when EAR < threshold

Adaptive Thresholding:

  1. Calculate baseline EAR over first 100 frames
  2. Set threshold = baseline * 0.75
  3. Continuously update baseline
  4. Adjust for individual variations

Glasses Mode:

  • Lower threshold (0.20 vs 0.25)
  • Increased sensitivity
  • Optimized for reflections

๐Ÿ“Š Data & Analytics

Database Schema

Blinks Table:

CREATE TABLE blinks (
    id INTEGER PRIMARY KEY,
    session_id INTEGER,
    timestamp DATETIME,
    ear_value REAL,
    threshold REAL
);

Sessions Table:

CREATE TABLE sessions (
    id INTEGER PRIMARY KEY,
    start_time DATETIME,
    end_time DATETIME,
    total_blinks INTEGER,
    avg_bpm REAL,
    duration_seconds INTEGER
);

Analytics Features

Real-time:

  • Session blinks counter
  • Blinks per minute (BPM)
  • Current EAR value
  • Baseline EAR
  • Active threshold

Historical:

  • Daily statistics
  • Weekly trends
  • Hourly patterns
  • Session history
  • Health insights timeline

๐ŸŽฏ Hackathon Highlights

Innovation

  1. MediaPipe Integration - First eye health app using Google's MediaPipe Face Mesh
  2. Adaptive Learning - Personalized baseline detection for each user
  3. Glasses Mode - Unique feature for eyewear users (60% of population)
  4. Background Monitoring - True set-and-forget operation
  5. Medical Research - Health insights based on ophthalmology studies

Impact

Target Users:

  • ๐Ÿ’ผ Office workers (8+ hours screen time)
  • ๐Ÿ‘จโ€๐Ÿ’ป Software developers
  • ๐ŸŽฎ Gamers
  • ๐Ÿ“š Students (online learning)
  • ๐Ÿ‘“ Eyewear users

Potential Reach:

  • 2 billion computer users worldwide
  • 60% experience digital eye strain
  • $2 billion annual productivity loss

Scalability

Current:

  • Desktop application (Windows)
  • Local processing
  • Single user

Future:

  • Cross-platform (macOS, Linux)
  • Mobile app (iOS, Android)
  • Enterprise dashboard
  • Cloud analytics
  • AI-powered predictions
  • Integration with health apps

๐Ÿ”’ Privacy & Security

Privacy-First Design

โœ… 100% Local Processing - No data leaves your device โœ… No Cloud Storage - All data stored in local SQLite database โœ… No Recording - Camera used only for landmark detection โœ… No Tracking - No analytics, no telemetry โœ… Open Source - Transparent, auditable code

Security Measures

  • Localhost Only - Web server bound to 127.0.0.1
  • No External Requests - Completely offline operation
  • Minimal Permissions - Only camera access required
  • Encrypted Storage - Database can be encrypted
  • No PII Collection - No personal information stored

๐Ÿ“ธ Screenshots

Dashboard

Dashboard Real-time monitoring with beautiful charts and statistics

System Tray

System Tray Background operation with live stats on hover

Health Insights

Health Insights Medical-based recommendations and alerts

Settings

Settings Customizable detection parameters

๐ŸŽฅ Demo Video

Kan Demo

Watch the full demo: YouTube Link

๐Ÿ” Troubleshooting

Quick Fixes

Camera not working?

# Check camera access
python -c "import cv2; print(cv2.VideoCapture(0).isOpened())"

Port 5000 in use?

# Change port in src/web_server.py
self.port = 5001  # Use different port

Detection not accurate?

  • Enable Glasses Mode if you wear glasses
  • Adjust EAR Threshold (lower = more sensitive)
  • Ensure good lighting
  • Position camera at eye level

Check logs:

type logs\eye_tracker.log  # Windows

๐Ÿ› ๏ธ Project Structure

kan/
โ”œโ”€โ”€ run_app.py              # Application entry point
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ .gitignore             # Git ignore rules
โ”‚
โ”œโ”€โ”€ src/                   # Source code
โ”‚   โ”œโ”€โ”€ app_opencv.py      # Main application (MediaPipe)
โ”‚   โ”œโ”€โ”€ camera_manager.py  # Camera management
โ”‚   โ”œโ”€โ”€ blink_detector_mediapipe.py  # MediaPipe detection
โ”‚   โ”œโ”€โ”€ web_server.py      # Flask web server
โ”‚   โ”œโ”€โ”€ system_tray.py     # System tray integration
โ”‚   โ”œโ”€โ”€ database.py        # SQLite database
โ”‚   โ”œโ”€โ”€ health_monitor.py  # Health analysis
โ”‚   โ””โ”€โ”€ health_notifier.py # Desktop notifications
โ”‚
โ”œโ”€โ”€ web-app/              # Standalone web version
โ”‚   โ”œโ”€โ”€ index.html        # Web app UI
โ”‚   โ”œโ”€โ”€ app.js            # Main JavaScript
โ”‚   โ”œโ”€โ”€ blink-detector.js # Detection logic
โ”‚   โ”œโ”€โ”€ db.js             # IndexedDB
โ”‚   โ””โ”€โ”€ health-insights.js # Health analysis
โ”‚
โ”œโ”€โ”€ templates/            # Flask templates
โ”‚   โ””โ”€โ”€ dashboard.html    # Dashboard template
โ”‚
โ”œโ”€โ”€ static/              # Static assets
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ dashboard.css
โ”‚   โ””โ”€โ”€ js/
โ”‚       โ””โ”€โ”€ dashboard.js
โ”‚
โ”œโ”€โ”€ data/                # Database storage
โ”‚   โ””โ”€โ”€ blink_tracker.db
โ”‚
โ”œโ”€โ”€ logs/                # Application logs
โ”‚   โ””โ”€โ”€ eye_tracker.log
โ”‚
โ””โ”€โ”€ venv-py311/          # Python virtual environment

๐Ÿงช Testing

# Test camera
python -c "import cv2; cap = cv2.VideoCapture(0); print('Camera OK' if cap.isOpened() else 'Camera Error')"

# Test MediaPipe
python -c "import mediapipe as mp; print('MediaPipe OK')"

# Run with debug mode
python run_app.py --debug

๐Ÿ“‹ Dependencies

Core Libraries

opencv-python>=4.8.0      # Computer vision
mediapipe>=0.10.0         # Face mesh detection
numpy>=1.24.0             # Numerical computing
scipy>=1.11.0             # Scientific computing

Web Framework

Flask>=2.3.0              # Web server
Flask-SocketIO>=5.3.0     # Real-time updates
python-socketio>=5.9.0    # Socket.IO support

Desktop Integration

pystray>=0.19.0           # System tray
Pillow>=10.0.0            # Image processing
plyer>=2.1.0              # Notifications

System Requirements

  • OS: Windows 10/11 (64-bit)
  • RAM: 2GB minimum, 4GB recommended
  • CPU: Intel i3 or equivalent
  • Camera: 720p webcam (30 FPS)
  • Storage: 500MB free space

๐Ÿ‘ฅ Team

Developed for [Hackathon Name]

๐Ÿ† Achievements

  • โœ… Fully Functional - Complete end-to-end solution
  • โœ… Modern Tech Stack - MediaPipe, Flask, Socket.IO
  • โœ… Beautiful UI - Apple-inspired design
  • โœ… Privacy-First - 100% local processing
  • โœ… Real Impact - Addresses genuine health problem

๐Ÿš€ Future Roadmap

Phase 1 (Current)

  • โœ… Desktop app with MediaPipe
  • โœ… Real-time monitoring
  • โœ… Health insights
  • โœ… Background operation

Phase 2 (Next 3 months)

  • ๐Ÿ“ฑ Mobile app (iOS/Android)
  • ๐ŸŒ Cross-platform support
  • ๐Ÿค– AI-powered predictions
  • ๐Ÿ“Š Advanced analytics

Phase 3 (6-12 months)

  • ๐Ÿข Enterprise version
  • โ˜๏ธ Cloud sync (optional)
  • ๐Ÿ‘ฅ Team dashboards
  • ๐Ÿ”— Health app integrations
  • ๐Ÿ’Š Prescription tracking

๐Ÿ“„ License

MIT License - See LICENSE file for details.

๐Ÿ™ Acknowledgments

Technology:

Research:

  • American Optometric Association - Digital eye strain guidelines
  • National Eye Institute - Blink rate studies
  • Journal of Ophthalmology - Computer vision syndrome research

Inspiration:

  • The 2 billion computer users experiencing digital eye strain
  • Personal experience with dry eyes from coding
  • Desire to create preventive health solutions

๐Ÿ“ž Contact

Questions? Feedback? Collaboration?

โญ Show Your Support

If you find Kan useful:

  • โญ Star this repository
  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest features
  • ๐Ÿ”„ Share with others
  • ๐Ÿค Contribute code

Kan (เฎ•เฎฃเฏ) - Protecting Your Vision, One Blink at a Time ๐Ÿ‘๏ธ

Built with โค๏ธ

Made with Python Powered by MediaPipe MIT License

About

Resources

Stars

Watchers

Forks

Contributors