{"id":15027394,"url":"https://github.com/antoinelame/gazetracking","last_synced_at":"2025-05-15T04:04:50.366Z","repository":{"id":37444762,"uuid":"169920451","full_name":"antoinelame/GazeTracking","owner":"antoinelame","description":"👀 Eye Tracking library easily implementable to your projects","archived":false,"fork":false,"pushed_at":"2024-07-22T14:58:06.000Z","size":70652,"stargazers_count":2271,"open_issues_count":56,"forks_count":579,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-05-15T04:04:44.709Z","etag":null,"topics":["eye-tracking","gaze-tracking","opencv","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoinelame.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-09T22:27:07.000Z","updated_at":"2025-05-14T14:56:57.000Z","dependencies_parsed_at":"2024-12-05T02:13:29.457Z","dependency_job_id":null,"html_url":"https://github.com/antoinelame/GazeTracking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinelame%2FGazeTracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinelame%2FGazeTracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinelame%2FGazeTracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinelame%2FGazeTracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoinelame","download_url":"https://codeload.github.com/antoinelame/GazeTracking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270641,"owners_count":22042858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eye-tracking","gaze-tracking","opencv","python"],"created_at":"2024-09-24T20:06:21.426Z","updated_at":"2025-05-15T04:04:45.353Z","avatar_url":"https://github.com/antoinelame.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gaze Tracking\n\n![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)\n![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)\n![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)\n[![GitHub stars](https://img.shields.io/github/stars/antoinelame/GazeTracking.svg?style=social)](https://github.com/antoinelame/GazeTracking/stargazers)\n\nThis is a Python (2 and 3) library that provides a **webcam-based eye tracking system**. It gives you the exact position of the pupils and the gaze direction, in real time.\n\n[![Demo](https://i.imgur.com/WNqgQkO.gif)](https://youtu.be/YEZMk1P0-yw)\n\n_🚀 Quick note: I'm looking for job opportunities as a software developer, for exciting projects in ambitious companies. Anywhere in the world. Send me an email!_\n\n## Installation\n\nClone this project:\n\n```shell\ngit clone https://github.com/antoinelame/GazeTracking.git\n```\n\n### For Pip install\nInstall these dependencies (NumPy, OpenCV, Dlib):\n\n```shell\npip install -r requirements.txt\n```\n\n\u003e The Dlib library has four primary prerequisites: Boost, Boost.Python, CMake and X11/XQuartx. If you doesn't have them, you can [read this article](https://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/) to know how to easily install them.\n\n\n### For Anaconda install\nInstall these dependencies (NumPy, OpenCV, Dlib):\n\n```shell\nconda env create --file environment.yml\n#After creating environment, activate it\nconda activate GazeTracking\n```\n\n\n### Verify Installation\n\nRun the demo:\n\n```shell\npython example.py\n```\n\n## Simple Demo\n\n```python\nimport cv2\nfrom gaze_tracking import GazeTracking\n\ngaze = GazeTracking()\nwebcam = cv2.VideoCapture(0)\n\nwhile True:\n    _, frame = webcam.read()\n    gaze.refresh(frame)\n\n    new_frame = gaze.annotated_frame()\n    text = \"\"\n\n    if gaze.is_right():\n        text = \"Looking right\"\n    elif gaze.is_left():\n        text = \"Looking left\"\n    elif gaze.is_center():\n        text = \"Looking center\"\n\n    cv2.putText(new_frame, text, (60, 60), cv2.FONT_HERSHEY_DUPLEX, 2, (255, 0, 0), 2)\n    cv2.imshow(\"Demo\", new_frame)\n\n    if cv2.waitKey(1) == 27:\n        break\n```\n\n## Documentation\n\nIn the following examples, `gaze` refers to an instance of the `GazeTracking` class.\n\n### Refresh the frame\n\n```python\ngaze.refresh(frame)\n```\n\nPass the frame to analyze (numpy.ndarray). If you want to work with a video stream, you need to put this instruction in a loop, like the example above.\n\n### Position of the left pupil\n\n```python\ngaze.pupil_left_coords()\n```\n\nReturns the coordinates (x,y) of the left pupil.\n\n### Position of the right pupil\n\n```python\ngaze.pupil_right_coords()\n```\n\nReturns the coordinates (x,y) of the right pupil.\n\n### Looking to the left\n\n```python\ngaze.is_left()\n```\n\nReturns `True` if the user is looking to the left.\n\n### Looking to the right\n\n```python\ngaze.is_right()\n```\n\nReturns `True` if the user is looking to the right.\n\n### Looking at the center\n\n```python\ngaze.is_center()\n```\n\nReturns `True` if the user is looking at the center.\n\n### Horizontal direction of the gaze\n\n```python\nratio = gaze.horizontal_ratio()\n```\n\nReturns a number between 0.0 and 1.0 that indicates the horizontal direction of the gaze. The extreme right is 0.0, the center is 0.5 and the extreme left is 1.0.\n\n### Vertical direction of the gaze\n\n```python\nratio = gaze.vertical_ratio()\n```\n\nReturns a number between 0.0 and 1.0 that indicates the vertical direction of the gaze. The extreme top is 0.0, the center is 0.5 and the extreme bottom is 1.0.\n\n### Blinking\n\n```python\ngaze.is_blinking()\n```\n\nReturns `True` if the user's eyes are closed.\n\n### Webcam frame\n\n```python\nframe = gaze.annotated_frame()\n```\n\nReturns the main frame with pupils highlighted.\n\n## You want to help?\n\nYour suggestions, bugs reports and pull requests are welcome and appreciated. You can also starring ⭐️ the project!\n\nIf the detection of your pupils is not completely optimal, you can send me a video sample of you looking in different directions. I would use it to improve the algorithm.\n\n## Licensing\n\nThis project is released by Antoine Lamé under the terms of the MIT Open Source License. View LICENSE for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoinelame%2Fgazetracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoinelame%2Fgazetracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoinelame%2Fgazetracking/lists"}