void detect_eye_in_image()
{
CvRect *face = (CvRect*)cvGetSeqElem(faces, 0);
printf("\nIn detect_eye_in_image() %d %d %d %d\n\n",imgcpy->height,imgcpy->width,face->width,face->height);
cvSetImageROI(
imgcpy, /* the source image */
cvRect(
face->x, /* x = start from leftmost */
face->y , /* y = a few pixels from the top */
face->width, /* width = same width with the face */
face->height/3 /* height = 1/3 of face height */
)
);
printf("\nIn detect_eye_in_image()");
CvSeq *eyes = cvHaarDetectObjects(
imgcpy, /* the source image, with the
estimated location defined */
cascade, /* the eye classifier */
storage, /* memory buffer */
1.15, 3, 0, /* tune for your app */
cvSize(25,25) /* minimum detection scale */
);
printf("\nIn detect_eye_in_image()");
/* draw a rectangle for each detected eye */
// for( i = 0; i < (eyes ? eyes->total : 0); i++ )
{
/* get one eye */
CvRect *eye = (CvRect*)cvGetSeqElem(eyes, 0);
/* draw a red rectangle */
cvRectangle(
imgcpy,
cvPoint(eye->x, eye->y),
cvPoint(eye->x + eye->width, eye->y + eye->height),
CV_RGB(255, 0, 0),
1, 8, 0
);
}
printf("\nIn detect_eye_in_image()");
Show_Image(imgcpy);
cvResetImageROI(imgcpy);
}
In the above function i keep getting the following output:
In detect_eye_in_image() 154 154 154 154
OpenCV Error: Assertion failed (rect.width >= 0 && rect.height >= 0 && rect.x < image->width && rect.y < image->height && rect.x + rect.width>= (int)(rect.widt h > 0) && rect.y + rect.height >= (int)(rect.height > 0)) in unknown function, f ile ........\ocv\opencv\src\cxcore\cxarray.cpp, line 3000
How to fix this problem?