To detect the left eye, perform these steps:
- Load the haarcascade_lefteye_2splits cascade classifier inside our program:
CascadeClassifier eyeDetectorleft("haarcascade_lefteye_2splits.xml");
- Since we want to detect the left eye in the face region, we will create a Mat variable called faceroi and inside it we will store the face region value:
Mat faceroi = videofeed(face[f]);
- Use the detectMultiScale function to create a vector of the Rect type called lefteye to detect the left eye region. The min neighbors parameter is set to 25 so that the classifier detects only the left eye. If we set min neighbors lower than 25, the haarcascade_lefteye_2splits classifier may also detect the right eye, which is not what we ...