Close

Advanced version using openCV and Python3

A project log for 20€ DIY-Eyetracker for school projects

Build an inexpensive eyetracker with primary school students - and control real world robots with block-based coding!

sergej-stoetzerSergej Stoetzer 04/23/2023 at 19:120 Comments

If you plan to use this project for secondary school students, you can ask them to do the video analysis in Python3 with the help of openCV. There are some fascinating tutorials out there explaining all the needed steps.

Usually, it's getting the image frame, convert to grayscale, using a filter to reduce noise, then running the analysis. You can either convert further to black and white and crop the image, so the only moving black spot is the iris, or you can look for circular shapes, and then check if their size is in the region that makes sense for an iris.

The parameters of black-white conversion or size of circles to look for, depends on tests you have to do yourself, using your build version...

Here's s short screenshot with different outputs from the sample code (check github link):

The sample code prints the x/y coordinates of the circle(s) found to the console for further inspection. Congratulations, your students now have successfully reduced complex pictures to x/y coordinates of the eye moving! From here they can easily build own applications for the eye tracker!

Discussions