I am working on a system that tracks the eye and log data like eye blinks, rate, etc. But I have a problem that the cv::Rect, returned after eye detection (haar detection), is jumping around so that the iris of the person appear on different positions in the matrix. in a 640x480 web cam frame, where the face is about 200px height the cv::Rect of the eye can jum about 40px each time I do the tracking. It jumps so far out that the eye sometimes is outside the rectangle representing the eye!
I am running this detection about 2 times per second, and in between I trace the eye by template mathcing. The template matching works great but sometimes the template slides of and after that keep track on the wrong position of the face. For example during a fast movement of the face the template can get stuck on the nose, or mouth.
I've tried 3 of the four eye classsifiers, (_eye, _mcs, _lefteye_2split). These three, according to the book "Master openCV..." is the best. But I cant se any big difference (more than the _mcs classifier is much slower)
It doesnt matter which one I use, So i was thinking that I might do something wrong!
Someone that is running eye detection multiple times with a good result?
My detector: eyeCascade.detectMultiScale(webcamFrame(ROI), detEye, 1.1, 3, CV_HAAR_FIND_BIGGEST_OBJECT|CV_HAAR_DO_CANNY_PRUNING|CV_HAAR_SCALE_IMAGE, cv::Size(20,20
ROI = centerpoint of last eye position, double width, double height. (4x sixe of eye position)