问题
In my application im going to implement face Recognition login... so i go with the openCV library for Recognize face... please help me to do this with sample code and tutorials....
Thanks in advance
回答1:
Well, my colleagues and I did some investigation on face recognition last year, and these are some of ours considerations about using integrated recognition tools vs JavaCV (the Java bindings for OpenCV):
Please check below tutorials
- Face Detection on Andriod Part-I ( Wayback link )
- Face Detection on Andriod Part-II ( Wayback link )
Hope it helps :)
回答2:
you can use NDK for using C/C++ OpenCV API
docs
beginner tutorial
void DetectMyFace ()
{
// image structure in opencv
IplImage *inImg = 0;
// face detector classifer
CvHaarClassifierCascade *clCascade = 0;
CvMemStorage *mStorage = 0;
CvSeq *faceRectSeq;
inImg = cvLoadImage("2.jpg");
mStorage = cvCreateMemStorage(0);
clCascade = (CvHaarClassifierCascade *)cvLoad("haarcascade_frontalface_default.xml", 0, 0, 0);
if ( !inImg || !mStorage || !clCascade )
{
printf("Initilization error : %s" , (!inImg)? "cant load image" : (!clCascade)?
"cant load haar cascade" :
"unable to locate memory storage");
return;
}
faceRectSeq = cvHaarDetectObjects(inImg,clCascade,mStorage,
1.2,
3,
CV_HAAR_DO_CANNY_PRUNING,
cvSize(25,25));
const char *winName = "Display Face";
cvNamedWindow(winName,CV_WINDOW_AUTOSIZE);
for ( int i = 0; i < (faceRectSeq ? faceRectSeq -> total:0); i++ )
{
CvRect *r = (CvRect*)cvGetSeqElem(faceRectSeq,i);
CvPoint p1 = { r->x, r->y };
CvPoint p2 = { r->x + r->width, r->y + r->height };
cvRectangle(inImg,p1,p2,CV_RGB(0,255,0),1,4,0);
}
cvShowImage(winName, inImg);
cvWaitKey(0);
cvDestroyWindow(winName);
// release the variables
cvReleaseImage(&inImg);
if(clCascade) cvReleaseHaarClassifierCascade(&clCascade);
if(mStorage) cvReleaseMemStorage(&mStorage);
}
回答3:
I have already made an Android app for Face Recognition using OpenCV. You can check it out: https://github.com/yaylas/AndroidFaceRecognizer
来源:https://stackoverflow.com/questions/10992247/android-face-recognition-using-opencv