在我的应用程序中我将实现面部识别登录...所以我使用openCV库进行识别面...请帮我用示例代码和教程来做这个....
提前致谢
答案 0 :(得分:1)
嗯,我的同事和我去年对人脸识别进行了一些调查,这些是我们使用集成识别工具与JavaCV(OpenCV的Java绑定)的一些考虑因素:
请查看以下教程
答案 1 :(得分:0)
您可以使用NDK来使用C / C ++ OpenCV API
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);
}
答案 2 :(得分:-1)
我已经使用OpenCV制作了面部识别的Android应用程序。你可以看一下:https://github.com/yaylas/AndroidFaceRecognizer