Ask Your Question

Eye detection and tracking

asked 2016-01-28 21:04:20 -0500

updated 2016-02-03 14:15:48 -0500

recently many questions were asked about the eye detection. for practise purpose, i tried to implement an initial code about this subject.

my main idea is based on detecting the eye pair and later track them.

  • firstly i used Multitracker class to track detected eyes but results were not satisfactory
  • secondly i tried to use matchTemplate function, it was better than Multitracker
  • lastly i tried to do eye detection on image ROI (the part of image that eye pair found before) results are better than my prior trials.

the code can be found on github

any suggestion about the code is welcome


i found a good sample code on

i will try to improve this code.

to test it you can look at VideoFaceDetector-Demo.cpp

edit retag flag offensive close merge delete


Hi @sturkmen , I have tested the code on the above link , it doesn't track face very well , is this the same with you ?

sarmad gravatar imagesarmad ( 2016-02-08 09:04:41 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-01-28 22:20:14 -0500

AdamIB gravatar image


It looks you've done a good job, but once I want to run It opened the web cam and I got error says that "Display Driver stopped responding and has recovered", so if I want to detect and track only for the video , can you please show what to do?

edit flag offensive delete link more


i added information about usage on github but the problem you mentioned is may not be related to my code. could you try sample code to be sure a basic video capture code works properly

sturkmen gravatar imagesturkmen ( 2016-01-29 04:36:04 -0500 )edit

Hi @sturkmen

when there is slight head movement the circle dots freezes at a specific location and tracks the eye

again only if the eyes return to the same dots location

sarmad gravatar imagesarmad ( 2016-01-29 06:42:06 -0500 )edit

i know this issue :). as i stated the code is very initial and not tested enough. let me try to improve

sturkmen gravatar imagesturkmen ( 2016-01-29 07:13:41 -0500 )edit

@sarmad i updated the code. the issue you mentioned is solved. did you try it with a sample video file?

sturkmen gravatar imagesturkmen ( 2016-01-29 10:52:08 -0500 )edit

I have tried it on video samples , it is fine when there is no head movement or slight movement ,

it fails to track eyes if head moves

sarmad gravatar imagesarmad ( 2016-01-30 07:36:33 -0500 )edit

@sturkmen , What about using flandmark to localize the eyes ? I think it is a good method

sarmad gravatar imagesarmad ( 2016-01-30 09:36:58 -0500 )edit

I am not sure but I think it will be too slow

sturkmen gravatar imagesturkmen ( 2016-01-30 10:42:25 -0500 )edit

@sturkmen , can you help me to run this code at Github I trying to compile it but I can't understand the type of errors that I get

sarmad gravatar imagesarmad ( 2016-01-31 11:45:38 -0500 )edit

@sarmad i forked it. compiled it with a small update. see

sturkmen gravatar imagesturkmen ( 2016-01-31 14:35:56 -0500 )edit

@sturkmen , Thanks for help , Have you tried it ? what do you think about it can be improved further ?

sarmad gravatar imagesarmad ( 2016-01-31 17:44:29 -0500 )edit

Question Tools


Asked: 2016-01-28 21:04:20 -0500

Seen: 1,612 times

Last updated: Feb 03 '16