Skip to content

LSIIM/eye-tracking-opencv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eye-tracking-opencv

The code within the teste_de_conceito folder consists of tests conducted to assess the feasibility of various implementation methods for the proposed solutions.

The combination that yielded the best results involved analyzing the face with MediaPipe and extracting the 468 landmarks. From these landmarks, the eye region was selected.

For each eye's corresponding image, a histogram analysis of the image colors was performed after applying some filters to attempt to determine the positions of the iris and pupil. The result was that the pupil is reasonably easy and consistent to obtain, however, the iris is not. Therefore, an additional step will be added to the analysis process using another MediaPipe algorithm that extracts the iris position from a face.

Prerequisites

  • Python 3.9
  • pipenv

How to Run

I use the pipenv package manager. If you do not have it installed, run pip install pipenv.

To execute the program:

  • pipenv shell
  • pipenv install
  • python main.py [arguments]

Rules

It is FORBIDDEN to place folders containing the '.' character in their name inside the /raw directory for batch processing. THE VIDEOS MUST BE NAMED record.avi OR record.mp4.

CLI Arguments Documentation

Description

The script accepts several command-line arguments to configure its global options. Below are the available options and their descriptions.

Arguments

Argument             Description Accepted Values Default Value
-showprocess Defines whether the process will be displayed. s (yes), n (no) n
-drawbb Defines whether the bounding box will be drawn. s (yes), n (no) n
-drawir Defines whether the iris will be drawn. s (yes), n (no) n
-drawpu Defines whether the pupil will be drawn. s (yes), n (no) n
-drawpp Defines whether the passed positions will be drawn. s (yes), n (no) s
-drawmp Defines whether the mask points will be drawn. s (yes), n (no) n
-drawheadpose Defines whether the head direction vector will be shown. s (yes), n (no) n
-draweyegaze Defines whether the gaze direction vectors of both eyes will be shown. s (yes), n (no) n
-showwarn Defines whether warnings will be displayed. s (yes), n (no) s
-multicore Defines whether multicore processing will be used. s (yes), n (no) n
-overwrite Defines whether existing files will be overwritten. If -multicore is s, the default is s. Otherwise, it is n. s (yes), n (no) n
-path Defines the path to the files. string "./vds"

Usage Example

python main.py -showprocess s -drawbb n -path "./meus_arquivos"

Note: If an invalid argument is provided for an option, the script will print an error message and terminate its execution.

How to Run the Visualization Generator

python visualization_generator/main.py <path to the csv file with the extracted data> [optional --verbose]

This will create a visualizations folder in the same directory as the csv file you provided, and it will save the visualizations inside.

Creating the Executable

pipenv run pyinstaller --onefile --paths [your_path] ./main.py --add-data '[your_path]\Lib\site-packages\mediapipe\modules:mediapipe/modules' --add-data '[your_path]\Lib\site-packages\mediapipe\python\solutions:mediapipe/solutions'

Replace [your_path] with the appropriate path for your environment.

About

A repo to follow the AiPhile Tutorial and make some changes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages