EyeGestures — представь: ты управляешь интерфейсом одними глазами, без мышки и клавиатуры. Это не фантастика — это EyeGestures: open-source библиотека, которая превращает твою вебку или камеру телефона в eye-tracker.
С её помощью можно строить приложения для управления взглядом, исследования или просто фана.
pip install eyeGestures
python3 examples/simple_example_v2.py
Пример кода:
from typing import Tuple, Optional
from eyeGestures.utils import VideoCapture
from eyeGestures import EyeGestures_v3
def run_eye_tracker(screen_width: int = 500, screen_height: int = 500) -> None:
"""
Запускает eye-tracking с помощью EyeGestures.
:param screen_width: ширина экрана в пикселях
:param screen_height: высота экрана в пикселях
"""
gestures = EyeGestures_v3()
cap = VideoCapture(0)
calibrate: bool = True
while True:
ret, frame = cap.read()
if not ret:
break
event, cevent = gestures.step(
frame,
calibrate,
screen_width,
screen_height,
context="my_context"
)
if event:
cursor_x, cursor_y = event.point[0], event.point[1]
fixation: Optional[bool] = event.fixation
saccades: Optional[bool] = event.saccadess # движение глаз
print(f"X: {cursor_x}, Y: {cursor_y}, Fixation: {fixation}, Saccades: {saccades}")
if __name__ == "__main__":
run_eye_tracker()
Сохрани пост, чтобы не потерять. Это тот самый случай, когда Python выглядит как магия
#python #soft #github
Please open Telegram to view this post
VIEW IN TELEGRAM
👍21🔥6❤4