:
:

void detectFaces(IplImage *img)
{

/* detect faces */
    CvSeq *faces = cvHaarDetectObjects(
        img,            /* the source image */
        cascade_f,      /* the face classifier */
        storage,        /* memory buffer, created with cvMemStorage */
        1.1, 3, 0,      /* special parameters, tune for your app */
        cvSize(40, 40)  /* minimum detection scale */
    );
 /* return if not found */
    if (faces->total == 0) return;

	 /* get the first detected face */
    CvRect *face = (CvRect*)cvGetSeqElem(faces, 0);
 
    /* draw a red rectangle */
    cvRectangle(
        img,
        cvPoint(face->x, face->y),
        cvPoint(
            face->x + face->width,
            face->y + face->height
        ),
        CV_RGB(255, 0, 0),
        1, 8, 0
    );


	/* Set the Region of Interest: estimate the eyes' position */

    cvSetImageROI(
        img,                    /* the source image */
        cvRect(
            face->x,            /* x = start from leftmost */
            face->y + (face->height/5.5), /* y = a few pixels from the top */
            face->width,        /* width = same width with the face */
            face->height/3.0    /* height = 1/3 of face height */
        )
    );

	/* detect the eyes */
    CvSeq *eyes = cvHaarDetectObjects(
        img,            /* the source image, with the
                           estimated location defined */
        cascade_e,      /* the eye classifier */
        storage,        /* memory buffer */
        1.15, 3, 0,     /* tune for your app */
        cvSize(25, 15)  /* minimum detection scale */
    );

	int i;
   
    /* draw a rectangle for each detected eye */
    for( i = 0; i < (eyes ? eyes->total : 0); i++ ) {
        /* get one eye */
        CvRect *eye = (CvRect*)cvGetSeqElem(eyes, i);
       
        /* draw a red rectangle */
        cvRectangle(
            img,
            cvPoint(eye->x, eye->y),
            cvPoint(eye->x + eye->width, eye->y + eye->height),
            CV_RGB(255, 0, 0),
            1, 8, 0
        );
	}

:
:
when i compiled it had said that detectFaces' local function definitions are illegal...what does mean??anyone please help me...

detectFaces() looks fine, so I suspect that either by misunderstanding or through a typo you've managed to create something that looks like nested functions. For example:

int main(void)
{
    ...

void detectFaces(IplImage *img)
{
    ...

Notice how main() isn't properly terminated with a closing brace. This would result in the compiler recognizing detectFaces as a function definition local to main(), which is illegal in C.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.