One of our readers is working on a project that does eye tracking with OpenCV and C#. He has asked for a little bit of assistance with his project. So, I’ve thrown together a basic starting point for him. If you’re interested, you can download the source code for this project below. It’s a basic Windows Form Application that uses a standard USB webcam to detect your eyes and display them in separate picture boxes. Here is the application in action.
All you have to do is open the solution and run it. I’ve already included all of the OpenCV runtimes and have even copied the Haar Cascade into the Debug folder. In fact, that might be the place you want to start. Just unzip the download below, browse to the Debug folder, and run the OpenCVWinForm.exe file. You should be good to go. If you have any questions, suggestions, or problems, please let me know in the comments below.
I’ll upload the newest source code when I get time to do some more work with it. Until then, be sure to checkout my other articles about working with OpenCV in C#.
Download: OpenCV Eye Tracker Source Code (5MB ZIP)