Цитата (x_X)
в гугле на эту тему все написано и разжевано, пиши конкретно, что неполучается 
 
 Я искал в гугле. Там половина кода не работает(может из-за древних версий OpenCV). Конкретно нужно добавить нахождение лицДобавлено (28.04.2013, 23:01)
---------------------------------------------
Разобрался 
 
Код
#include <opencv/cv.h> 
 #include <opencv2/highgui/highgui.hpp> 
 #include <opencv2/objdetect/objdetect.hpp> 
 #include <opencv2/imgproc/imgproc.hpp> 
 #include <stdlib.h> 
 #include <stdio.h> 
 using namespace std; 
 using namespace cv; 
 IplImage* image = 0; 
 CvMemStorage* pStorageface = 0; 
 CvHaarClassifierCascade* face_cascade = 0; 
 void Detect(IplImage* image){ 
     
    CvSeq * pFaceRectSeq; 
    pStorageface = cvCreateMemStorage(0); 
     
         pFaceRectSeq = cvHaarDetectObjects 
                 (image, face_cascade, pStorageface, 
                 1.1,                       // increase search scale by 10% each pass 
                 3,                         // merge groups of three detections 
                 CV_HAAR_DO_CANNY_PRUNING,  // skip regions unlikely to contain a face 
                 cvSize(1,1));            // smallest size face to detect = 40x40 
   
   int i; 
     
         for(i=0;i<(pFaceRectSeq? pFaceRectSeq->total:0); i++ ) 
         { 
                 CvRect* r = (CvRect*)cvGetSeqElem(pFaceRectSeq, i); 
                 CvPoint pt1 = { r->x, r->y }; 
                 CvPoint pt2 = { r->x + r->width, r->y + r->height }; 
                 cvRectangle(image, pt1, pt2, CV_RGB(0,0,255), 3, 4, 0); 
         } 
   
         cvShowImage("Third Eye", image); 
 } 
 int main( int argc, char** argv ){ 
  face_cascade = (CvHaarClassifierCascade *)cvLoad("C:\\Program Files\\opencv\\data\\haarcascades\\haarcascade_frontalface_alt_tree.xml", 0 , 0, 0); 
  char* filename = argc == 2 ? argv[1] : "C:/many1.jpg"; 
   
  image = cvLoadImage(filename,1); 
     cvNamedWindow("Third Eye",CV_WINDOW_AUTOSIZE); 
  Detect(image); 
    //cvShowImage("Third Eye",image); 
   
  printf("INFO ABOUT IMAGE %s\n", filename); 
  printf("Channels: %d\n", image->nChannels ); 
     printf("Pixel depth: %d bits\n", image->depth ); 
     printf("Width: %d pixels\n", image->width ); 
     printf("Height: %d pixels\n", image->height ); 
     printf("Image size: %d bytes\n", image->imageSize ); 
     printf("Width step: %d bytes\n", image->widthStep ); 
     cvWaitKey(0); 
     cvReleaseImage(& image); 
     cvDestroyWindow("Third Eye"); 
     return 0; 
 }