- Open cmd on windows and create a virtual env using
python -m venv \path\to\env
- Activate your env using
.\path\to\env\Scripts\activate
- Install the necessary libraries using
pip install opencv-python
pip install numpy
- Clone this repo using
git clone https://github.com/kartik1395/Eye_Centroid.git
- Open cmd and go to the location of the repo.
- Run the code using
python eye_centroid.py --video \path\to\video
- The video should be displayed with the Eye Tracking in place.
- Press "p" to pause/play the video.
- Press "q" to exit the video.
Assumptions are made based on the videos in the folder 'daniel-ir'.
- The first thing we do is convert the frame to grayscale for better results.
- Then we use haarcascade for eyes provided by opencv to extract the ROI.
- We expand the ROI by a few pixels to get a better result.
- Once we have the ROI i.e the eyes, we use HoughCircles method to extract the pupil and the centroid.
- The parameters of the HoughCircles method were tuned to detect the pupils and centroid thoroughly. The min and max radius has been set according to the sample videos provided.
- There is a frame counter on the original video.
- Once an eye is detected, it is displayed in a separate window for visualisation.
- There is play/pause control using "p".