Reputation: 45
I made a C++ program using OpenCV to allow the use of my webcam to recognize my face and my eyes. I would then like to determine the center of my pupils and then the point or area of gaze on my screen. Does anybody know how to do that? Please not my program uses a simple computer webcam. Thank you in advance for your advice.
Upvotes: 2
Views: 3583
Reputation: 378
In case you are looking to identify the Point of Gaze on your laptop screen. Then below is method you can use:
Using shape_predictor_68_face_landmarks.dat, get the eye landmarks (six points per eye)
Calculate the center of eye (Ex, Ey) from the eye landmarks
If you could get the iris center (Ix, Iy) from above answer or from HCT
Calculate scaling factor : W(eye) = Topleftcorner(x) - Toprightcorner(x)
H(eye) = Topleftcorner(x) - Toprightcorner(x)
Scaling factor R(x) = W(screen)/W(eye) R(y) = H(Screen)/H(eye)
POG (x) = (W(Screen)/2) + (R(x) *r (x)) POG (y) = (H(Screen)/2) +(R(y) *r(y))
r(x) and r(y) indicates the distance of Iris from Eye Center which is calculated as follows:
r(x) = COI (x) - COE (x)
, r(y) = COI(y) - COE (x)
Hope this helps!!
Upvotes: 5
Reputation: 5564
I think my Optimeyes project here:
https://github.com/LukeAllen/optimeyes
does what you're looking for: pupil detection and gaze tracking. Its included "Theory Paper" pdf discusses the principles of operation, and has references to other papers. The project was written using the Python version of OpenCV but you're welcome to port it to C++!
Upvotes: 7