63 m_pStorage = cvCreateMemStorage(0);
69 cvReleaseMemStorage(&m_pStorage);
72 cvReleaseHaarClassifierCascade(&m_pCascade);
83 cvReleaseHaarClassifierCascade(&m_pCascade);
85 m_pCascade = (CvHaarClassifierCascade *) cvLoad(pCascadePath, 0, 0, 0);
87 return m_pCascade != 0;
97 cvClearMemStorage(m_pStorage);
101 const CvSeq *pFaces = cvHaarDetectObjects(pIplImage, m_pCascade, m_pStorage, 1.3, 3, CV_HAAR_DO_CANNY_PRUNING, cvSize(40, 40));
102 const int nFaces = pFaces ? pFaces->total : 0;
104 for (
int i = 0; i < nFaces; i++)
106 CvRect* r = (CvRect *) cvGetSeqElem(pFaces, i);
111 region.
max_x = r->x + r->width;
112 region.
max_y = r->y + r->height;
114 regionList.push_back(region);
117 cvReleaseImageHeader(&pIplImage);
IplImage * Adapt(const CByteImage *pImage, bool bAllocateMemory=false)
Converts a CByteImage to an IplImage.
std::vector< MyRegion > RegionList
int Find(CByteImage *pImage, RegionList ®ionList)
bool Init(const char *pCascadeFilePath)
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...