Project screen to track the eye tracking

1 view (last 30 days)
Benny Leung
Benny Leung on 4 Oct 2016
Answered: Dimitris Iliou on 14 Oct 2016
Hi everyone, I am doing the eye tracking test and writing the MATLAB program for it. I had researched about how to project the screen in MATLAB but cannot find it. So I want to ask about how to plot the screen and tracking the circle point in the screen?

Answers (1)

Dimitris Iliou
Dimitris Iliou on 14 Oct 2016
If I understand correctly, you want to capture the screen of your computer into MATLAB and then locate the circles in there.
I do not think that there is a way to capture your screen in real-time and insert it into MATLAB. If you are using an eye-tracking software, my suggestion would be to capture the process in video format and then import the video in MATLAB using the VideoReader function. You can find more details for this function in the following link:
Once you import the video into MATLAB you can process each frame to locate the circles. I would like to suggest the following workflow to do that:
  1. Since you already know the background of your screen, have a snapshot of it without the circles. Then, once you have a frame of your video subtract the background snapshot from it. The resulting image should be a black image with only the two circles being visible.
  2. To locate the circle, you could use the imfindcircles function. You can find more details on how to use this function, as well as examples, on the following link:
You could directly go to step 2 but, performing step 1 first will allow you to avoid any false positives (circles included in your background image). In case you want to avoid step 1, you could set the radiusRange property of the imfindcircles function to the radius of the circles that you want to detect.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!