I have decided to use the OpenCV template matching function, and just using it in Square Difference mode. It is not amazingly efficient, but its not bad.
It works quite well, I have made the box around the eyes stick in place, on the face, and so now I really just need to make everything more efficient and accurate. Then I can do a bit of maths and work out some estimates for where the person is looking. Hopefully.
When it is a bit better I will post a video, but for now here are some pictures of the template matching working:
And here is a video of it at work! In this video I am slowly moving my head from left to right:
This is good, but notice how now, when I move my eyeballs from side to side, the estimation follows my iris imperfectly. This destroys a lot of the accuracy. So after much deliberation, and surfing through papers of people who have done similar things to me, I decided that I should search the area near the current estimations for either the local centre of mass, or the local minimum. I tested both of these, and they both seem to improve the accuracy of the estimate. I’m unsure as to which I should use, or maybe both… I also need to test different sizes of search area!
Here is a video of this: