mirror of
https://github.com/ck-zhang/EyePy.git
synced 2025-12-31 00:10:06 -06:00
8485801cb3fb6abab1d999902235c3469b2ace32
EyePy
This is a Python library that provides webcam-based eye tracking. Extract facial features, train eye tracking model and predict gaze with super easy to use interface.
Usage Showcase
Installation and Interactive Demo
Clone this project:
git clone https://github.com/ck-zhang/EyePy
Using Pip
pip install -r requirements.txt
python demo.py
Using uv
pip install uv
uv sync
uv run demo.py
Usage
Initialization
from EyePy import GazeEstimator
gaze_estimator = GazeEstimator()
Feature Extraction
import cv2
image = cv2.imread('image.jpg')
features, blink_detected = gaze_estimator.extract_features(image)
if blink_detected:
print("Blink detected!")
else:
print(features)
Training the Model
X = [...] # Features
y = [...] # Gaze coordinates
gaze_estimator.train(X, y)
Predicting Gaze Location
predicted_gaze = gaze_estimator.predict([features])
print(predicted_gaze)
Future Work
TODO
- Improve demo calibration
- Blink detection
- Integrate with opentrack
- Mouse control functionality
Any suggestions for features and improvements are welcome.
If you enjoyed using EyePy, consider giving it a star.
Languages
Python
100%