I set up ROI for eye region . I converted this region to ycbcr channel , and I splitted Y channel from it.
when I show the ycbcr channel the eye area is showed in normal ycbcr colors,
My problem is that when I show Y channel it doesn't show the ROI Y channel which it should be the same as ycbcr but in grey
this is the output image for Ycbcr and Y channel . any I idea why this happening ?
My code :
for (i = 0; i < faces.size(); i++) // Iterate through all current elements (detected faces)
{
Point pt1(faces[i].x, faces[i].y); // Display detected faces on main window
Point pt2((faces[i].x + faces[i].height), (faces[i].y + faces[i].width));
rectangle(frame, pt1, pt2, Scalar(0, 255, 0), 2, 8, 0);
// set ROI for the eyes
Rect Roi = faces[i];
Roi.height = Roi.height / 4;
Roi.y = Roi.y + Roi.height;
cv::Mat crop = frame(Roi);
cvtColor(crop, ycbcr, CV_BGR2YCrCb);
imshow("ROI ",ycbcr);
vector<Mat> channels;
split(ycbcr, channels);
medianBlur(channels[0], channels[0], 3);
Mat eye_region_Ychannel = channels[0].clone();
imshow("Y", channels[0]);