Skip to content

ImaginationGod/Eye-Controlled-Cursor-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👁️ Eye-Controlled Cursor System using MediaPipe & Computer Vision

An intelligent, webcam-based eye-controlled cursor system that enables hands-free computer interaction using real-time facial landmark tracking, blink detection, and gaze-based interaction zones.

This project demonstrates how modern computer vision techniques can be used to build accessible and low-cost human-computer interaction systems without requiring expensive eye-tracking hardware.

Built using Python, OpenCV, and MediaPipe Face Landmarker Task API, the system transforms a standard laptop webcam into a functional eye-tracking interface capable of:

  • 🖱️ Cursor Movement
  • 👁️ Blink-to-Click Interaction
  • 📜 Gaze-Based Scrolling
  • 🔒 Click Lock / Unlock Zones
  • 🎯 Real-Time Face & Gaze Visualization
  • ⚡ Adjustable Smoothing & Sensitivity Controls

🔗 LinkedIn Post

Read the full project post on LinkedIn:

https://www.linkedin.com/posts/harsh-tripathi-440b0a134_python-computervision-mediapipe-ugcPost-7462537296689635328-YE4e/?utm_source=share&utm_medium=member_desktop&rcm=ACoAACDpifAB0vJYbgMjIGnmjZIgxCaNnw3k7xY


🌍 Real-World Impact

Traditional eye-tracking systems often require:

  • Specialized IR cameras
  • Dedicated sensors
  • Expensive proprietary hardware

This project aims to provide a hardware-efficient and accessible alternative that works using only a standard laptop webcam.

Potential applications include:

  • ♿ Assistive technology for users with limited mobility
  • 🧠 Human-Computer Interaction (HCI) research
  • 👁️ Gaze-based UI systems
  • 🖥️ Hands-free computing environments
  • 🎓 Educational & research purposes

🚀 Features

👁️ Real-Time Eye Tracking

Tracks facial landmarks and maps eye/head movement to screen coordinates.


🖱️ Cursor Control

Moves the system cursor using gaze/head tracking with configurable:

  • Sensitivity
  • Smoothing
  • Dead-zone stabilization

👀 Blink-to-Click

Detects eye blinks using Eye Aspect Ratio (EAR) calculations.

Supports:

  • Single-click interactions
  • Configurable blink threshold
  • Frame-based blink validation

📜 Scroll Interaction Zones

Custom gaze-controlled zones enable scrolling without touching the mouse or keyboard.

Scroll Logic

  • Move cursor into scroll zone
  • Hold gaze briefly
  • Continuous scrolling begins
  • Exit zone to stop scrolling

🔒 Click Lock / Unlock Zone

Allows users to temporarily disable clicking while still moving the cursor freely.

Useful for:

  • Reading
  • Browsing
  • Watching content
  • Preventing accidental clicks

🎯 Real-Time UI Overlay

Visual overlays include:

  • Nose/gaze tracking point
  • Interaction zones
  • Status indicators
  • Debug information
  • FPS counter

⚙️ Fully Configurable System

All major parameters can be customized from a single settings file.

Examples:

CURSOR_SENSITIVITY
SMOOTHING
BLINK_THRESHOLD
BLINK_FRAMES
SCROLL_SPEED
ZONE_WIDTH
ZONE_HEIGHT

🧠 Technologies Used

Core Technologies

  • Python
  • OpenCV
  • MediaPipe Task API
  • NumPy
  • PyAutoGUI

Computer Vision Concepts

  • Facial Landmark Detection
  • Eye Aspect Ratio (EAR)
  • Gaze Mapping
  • Cursor Smoothing
  • Motion Filtering
  • Real-Time Tracking
  • Human-Computer Interaction (HCI)

🧩 System Architecture

flowchart TD

A[Webcam Feed] --> B[MediaPipe Face Landmark Detection]
B --> C[Eye & Head Tracking]
C --> D[Cursor Mapping Engine]

D --> E[Cursor Movement]
D --> F[Blink Detection]
D --> G[Interaction Zones]

F --> H[Mouse Click]
G --> I[Scroll System]
G --> J[Click Lock / Unlock]

E --> K[System Cursor Control]
I --> K
H --> K
J --> K
Loading

📂 Project Structure

.
├── config
│   └── settings.py

├── core
│   ├── blink_detector.py
│   ├── calibration.py
│   ├── camera.py
│   ├── cursor_controller.py
│   ├── eye_tracker.py
│   ├── face_mesh.py
│   └── interaction_zones.py

├── models
│   └── face_landmarker.task

├── ui
│   ├── calibration_screen.py
│   ├── overlay.py
│   ├── zones_overlay.py
│   └── debug_overlay.py

├── utils
│   ├── drawing_utils.py
│   ├── fps_counter.py
│   └── math_utils.py

├── main.py
├── requirements.txt
└── README.md

🛠️ Installation

1️⃣ Clone Repository

git clone https://github.com/your-username/eye-controlled-cursor.git
cd eye-controlled-cursor

2️⃣ Install Dependencies

pip install -r requirements.txt

Or manually:

pip install opencv-python mediapipe pyautogui numpy pygetwindow

▶️ Running the Project

python main.py

Press:

ESC

to exit the application.


⚙️ Configuration

All major system parameters are configurable from:

config/settings.py

Example:

# Cursor Movement
CURSOR_SENSITIVITY = 1.5
SMOOTHING = 5

# Blink Detection
BLINK_THRESHOLD = 0.21
BLINK_FRAMES = 2

# Interaction Zones
REST_ZONE_DWELL_TIME = 1.2
SCROLL_ZONE_DWELL_TIME = 0.8

# Scroll
SCROLL_SPEED = 3

# Zone Dimensions
ZONE_WIDTH = 120
ZONE_HEIGHT = 300

👁️ Blink Detection Logic

The project uses Eye Aspect Ratio (EAR) to detect blinks.

Formula

EAR = (vertical_distance_1 + vertical_distance_2) / (2 * horizontal_distance)

When eyes close:

  • Vertical distance decreases
  • EAR drops below threshold
  • Blink is detected

📜 Scroll Zone Logic

The left edge of the screen acts as a scroll activation zone.

Workflow

  1. Move cursor into scroll zone
  2. Hold briefly
  3. Scroll activates
  4. Move out of zone to stop

Upper half:

  • Scroll Up

Lower half:

  • Scroll Down

🔒 Click Lock Logic

The right edge of the screen acts as a click toggle zone.

Workflow

  1. Move cursor into rest zone
  2. Hold briefly
  3. Clicking gets disabled/enabled
  4. Cursor movement remains active

📊 Processing Pipeline

flowchart LR

A[Webcam Input]
--> B[Face Landmark Detection]
--> C[Eye Tracking]
--> D[Gaze Mapping]
--> E[Cursor Smoothing]
--> F[Mouse Actions]

F --> G[Move Cursor]
F --> H[Blink Click]
F --> I[Scroll Zones]
Loading

🎥 Demo Video

📹 Project Demonstration

Eye.Screen.recording.1.mp4

📷 Example UI

🖥️ Features Visible

  • Face tracking
  • Gaze point
  • Scroll zones
  • Click status
  • FPS counter
  • Debug information

📸 Screenshots

Screenshot 2026-04-15 143905 Screenshot 2026-04-10 215954

📄 Research Paper

This project is also being explored from a research and accessibility perspective.

Research Focus Areas

  • Low-cost eye tracking systems
  • Human-computer interaction
  • Accessibility technology
  • Webcam-based gaze estimation
  • Real-time computer vision interfaces

Research paper link/publication

https://www.ijert.org/eye-controlled-cursor-system-a-low-cost-approach-to-hands-free-human-computer-interaction-ijertv15is020752


🧪 Challenges Faced

Some of the major engineering challenges included:

  • Cursor drift stabilization
  • Webcam noise reduction
  • Blink detection accuracy
  • Smooth scrolling behavior
  • Real-time performance optimization
  • Balancing sensitivity and usability

📈 Future Improvements

Planned Features

  • 🎯 Advanced calibration system
  • 🧠 AI-based adaptive smoothing
  • 👄 Gesture controls
  • 🖱️ Dwell-click interaction
  • 📱 Multi-monitor support
  • ⚡ Better gaze estimation
  • 🎨 Enhanced UI/UX
  • 🔊 Voice-assisted controls

⚠️ Current Limitations

  • Works best under good lighting
  • Webcam quality affects accuracy
  • Rapid head movement may reduce stability
  • Long usage may require recalibration

📚 Concepts Demonstrated

This project demonstrates concepts from:

  • Computer Vision
  • Human-Computer Interaction
  • Real-Time Systems
  • Accessibility Engineering
  • Facial Landmark Tracking
  • Gaze Estimation
  • UI/UX Interaction Design

🤝 Collaboration

Built by Harsh Tripathi in collaboration with Iqra Tabassum.


❤️ Acknowledgments

Special thanks to the open-source tools and libraries that made this project possible:

  • MediaPipe
  • OpenCV
  • NumPy
  • PyAutoGUI
  • Python Community

⭐ If You Like This Project

Consider giving the repository a star ⭐

It helps support future improvements and accessibility-focused innovation.


About

An intelligent eye-controlled cursor system built using Python, OpenCV, and MediaPipe Face Landmarker Task API. This project enables hands-free computer interaction using real-time facial landmark tracking, blink detection, gaze-based cursor movement, and scrolling zones — all using a standard laptop webcam without specialized hardware.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages