资源简介

linux下人脸识别算法,完整个的软件,基于QT,可以识别人脸,需要先训练,然后再识别,识别率虽然不是太高,但是完全是可以用的,功能强大。

资源截图

代码片段和文件信息

/** @file */

/*
    Detector Class - Inherits FACE DETECTOR AND EYE DETECTOR CLASS
    Copyright (C) 2009 Rohan Anil (rohan.anil@gmail.com) -BITS Pilani Goa Campus

    http://code.google.com/p/pam-face-authentication/

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation version 3 of the License.

    This program is distributed in the hope that it will be useful
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not see .
*/

#include “detector.h“
#include “cv.h“
#include 
#include 
#include “utils.h“
#include “qtUtils.h“

#define eyeSidePad 30
#define eyeTopPad 30
#define eyeBottomPad 120


IplImage * preprocess(IplImage * imgCvPoint plefteyeCvPoint prighteye)
{

    IplImage * face= cvCreateImage( cvSize(140150)83);
    IplImage* imgDest = cvCreateImage( cvSize(img->widthimg->height)83);
    cvZero(face);
    double yvalue=prighteye.y-plefteye.y;
    double xvalue=prighteye.x-plefteye.x;
    double ang= atan(yvalue/xvalue)*(180/CV_PI);
    double width= sqrt(pow(xvalue2)+pow(yvalue2));
    double ratio=sqrt(pow(xvalue2)+pow(yvalue2))/80;
    double sidePad=eyeSidePad*ratio;
    double topPad=eyeTopPad*ratio;
    double bottomPad=eyeBottomPad*ratio;
    CvPoint p1LeftTopp1RightBottom;
    p1LeftTop.x=plefteye.x-sidePad;
    p1LeftTop.y=(plefteye.y)-topPad;
    p1RightBottom.x=plefteye.x+width+sidePad;
    p1RightBottom.y=(plefteye.y)  +bottomPad;
    rotate(angplefteye.x plefteye.yimgimgDest);
    cvSetImageROI(imgDestcvRect(p1LeftTop.xp1LeftTop.yp1RightBottom.x-p1LeftTop.xp1RightBottom.y-p1LeftTop.y));
    cvResize(imgDestfaceCV_INTER_LINEAR);
    cvResetImageROI(imgDest);
    return face;
}


detector::detector()
{
    messageIndex=-1;

    clippedFace=0;
    boolClipFace=0;
    totalFaceClipNum=0;
    clipFaceCounter=0;
    prevlengthEye=0;
    inAngle=0;
    lengthEye=0;
    widthEyeWindow=0;
    heightEyeWindow=0;


}

IplImage * detector::clipFace(IplImage * inputImage)
{
    if (inputImage==0)
        return 0;
    if (eyesInformation.LE.x>0 && eyesInformation.LE.y>0 &&eyesInformation.RE.x>0 && eyesInformation.RE.y>0 )
    {
        IplImage *face=preprocess(inputImageeyesInformation.LEeyesInformation.RE);
        return face;
    }
    else
        return 0;

}


int detector::runDetector(IplImage * input)
{
    messageIndex=-1;
    static int flag;
    if (input==0)
        return -1;


    runFaceDetector(input);

    if (checkFaceDetected()==1)
    {
        if (faceInformation.Width<120 || faceInformation.Height<120)
        {
            messageIndex=0;

        }
        else if (faceInformation.Wi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        274  2009-08-09 05:51  pam-face-authentication-0.3\pam-face-authentication-0.3\AUTHORS

     文件         41  2009-08-09 05:09  pam-face-authentication-0.3\pam-face-authentication-0.3\ChangeLog

     文件       7881  2009-07-13 05:15  pam-face-authentication-0.3\pam-face-authentication-0.3\cmake\modules\FindOpenCV.cmake

     文件       1883  2009-07-13 05:15  pam-face-authentication-0.3\pam-face-authentication-0.3\cmake\modules\FindPAM.cmake

     文件       4757  2009-08-10 00:41  pam-face-authentication-0.3\pam-face-authentication-0.3\CMakeLists.txt

     文件      18002  2009-07-13 06:04  pam-face-authentication-0.3\pam-face-authentication-0.3\COPYING

     文件     919871  2009-07-13 07:31  pam-face-authentication-0.3\pam-face-authentication-0.3\data\haarcascades\haarcascade.xml

     文件     504200  2009-07-13 07:31  pam-face-authentication-0.3\pam-face-authentication-0.3\data\haarcascades\haarcascade_eye.xml

     文件    1095035  2009-07-13 07:31  pam-face-authentication-0.3\pam-face-authentication-0.3\data\haarcascades\haarcascade_eye_tree_eyeglasses.xml

     文件    1633787  2009-07-13 07:31  pam-face-authentication-0.3\pam-face-authentication-0.3\data\haarcascades\haarcascade_nose.xml

     文件      23511  2009-06-18 03:23  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\about.png

     文件      23103  2009-06-29 08:22  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\bkg.png

     文件      30128  2009-07-09 01:50  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\cnc.png

     文件      28544  2009-06-29 06:25  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\intro.png

     文件     118269  2009-06-18 03:23  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\magnifying-glass.jpg

     文件        794  2009-08-07 08:47  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\message1.png

     文件     110520  2009-08-06 12:01  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\pfa-logo.png

     文件      14608  2009-06-18 03:23  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\record.png

     文件       7552  2009-06-29 05:48  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\images\webcam.png

     文件      20696  2009-08-09 00:11  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\uifiles\aboutDialog.ui

     文件      23781  2009-06-29 08:21  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\uifiles\faceAuth.ui

     文件      23796  2009-08-09 00:20  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\uifiles\faceTrainer.ui

     文件       8954  2009-08-09 00:54  pam-face-authentication-0.3\pam-face-authentication-0.3\data\ui\uifiles\faceTrainerAdvSettings.ui

     文件        380  2009-08-09 00:48  pam-face-authentication-0.3\pam-face-authentication-0.3\graphics.qrc

     文件        385  2009-08-07 10:52  pam-face-authentication-0.3\pam-face-authentication-0.3\include\aboutBox.h

     文件       3185  2009-08-07 10:53  pam-face-authentication-0.3\pam-face-authentication-0.3\include\detector.h

     文件       1474  2009-08-07 10:53  pam-face-authentication-0.3\pam-face-authentication-0.3\include\eyesDetector.h

     文件       1467  2009-08-07 10:55  pam-face-authentication-0.3\pam-face-authentication-0.3\include\faceDetector.h

     文件       2163  2009-08-07 10:53  pam-face-authentication-0.3\pam-face-authentication-0.3\include\faceTrainer.h

     文件       1950  2009-08-07 10:53  pam-face-authentication-0.3\pam-face-authentication-0.3\include\faceTrainerAdvSettings.h

............此处省略42个文件信息

评论

共有 条评论