1 | initial version |
You should use the region of interest, which is the location of the eyes, to cut out a part of the original image, which is still in BGR color and not grayscale, then you should apply some color space conversion to it.
The following snippet does that, just put it at the proper place in your code.
// When looping over the eyes
// The deep clone is needed to have seperate data
Mat eye_region = frame(eyes[j]).clone();
Mat eye_region_YCbCr;
cvtColor(eye_region, eye_region_YCbCr, CV_BGR2YCrCb);
vector<Mat> channels;
split(eye_region_YCbCr, channels);
Mat eye_region_Ychannel = channels[0].clone();