I have been working on eye detection and I want to detect and then extract the eyes from video feed at specific interval. I want to store the detected eyes in form of images. I have done the detection of eyes using haar cascade. Now I just want to store the detected eyes in form of images.
Can anyone tell me what I can do to for the problem ?
The detection code is as follows
----------
int main()
{
CascadeClassifier face, eye;
if(!face.load("C:\\HAAR\\haarcascade_frontalcatface.xml")){
printf("Error Loading Face Cascade");
return -1;
}
if(!eye.load("C:\\HAAR\\haarcascade_eye_tree_eyeglasses.xml")){
printf("Error Loading Eye Cascade");
return -1;
}
VideoCapture capture(0);
if(!capture.isOpened())
{
printf("Error opening Video Stream");
return -1;
}
Mat capimg,greyimg;
vector faces,eyes;
while(1)
{
capture>>capimg;
waitKey(10);
cvtColor(capimg, greyimg, CV_BGR2GRAY);
cv::equalizeHist(greyimg,greyimg);
face.detectMultiScale(greyimg, faces, 1.1, 10, CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING, cvSize(0,0), cvSize(300,300));
for(int i=0; i < faces.size(); i++)
{
Point pt1(faces[i].x+faces[i].width,faces[i].y+faces[i].height);
Point pt2(faces[i].x,faces[i].y);
Mat faceroi=greyimg(faces[i]);
eye.detectMultiScale(faceroi, eyes,1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30,30));
for(size_t j=0; j
↧