[qt+opencv] Realize face recognition punch card system 2.0

1. Introduction

Face Recognition Version 1.0:

[QT] Punch card system based on face recognition (QT+Opencv + SQLite)--design process https://blog.csdn.net/qq_40602000/article/details/99674066?spm=1001.2014.3001.5502

Face Recognition Version 2.0:

Based on the suggestions of fans, some modifications have been made on the basis of 1.0

1. Reduce the cumbersome configuration of opencv, open the project to compile and run (solve the problem of improper path configuration and compilation failure);

# opencv
OPENCVPATH=$$PWD/../../3rdparty/opencv64
OPENCV_LIB=$$OPENCVPATH/x64/mingw/lib
OPENCV_INC=$$OPENCVPATH/include

INCLUDEPATH +=$$OPENCV_INC
INCLUDEPATH +=$$OPENCV_INC/opencv
INCLUDEPATH +=$$OPENCV_INC/opencv2

LIBS += $$OPENCV_LIB/libopencv*

BINPATH=$$PWD/../../bin
LIBSPATH = $$PWD/../Libs

2. The at.txt file used for generating training using python script was removed, and it was written in C++ (to solve the problem of no python environment);

QStringList Util::getFileFolders(const QString &dirPath)
{
    QStringList folderList;
    QDir dir(dirPath);
    dir.setFilter(QDir::Dirs);
    foreach(QFileInfo fullDir, dir.entryInfoList())
    {
        if(fullDir.fileName() == "." || fullDir.fileName() == "..") continue;
        folderList.append(fullDir.fileName());
    }
    return folderList;
}

void Util::createAtLabel(const QString &facePath, const QString &atPath)
{
    qDebug() <<facePath;
    qDebug()<<atPath;
    deleteFileOrFolder(atPath);
    QFile file(atPath);
    file.open(QIODevice::ReadWrite | QIODevice::Text); 
    QStringList idList = getFileFolders(facePath);
    qDebug()<<idList;
    foreach (QString id, idList) {
        QString oneFacePath = facePath + "\\" + id;
        QStringList imageList = getImageFileNames(oneFacePath);
        foreach (QString name, imageList) {
            QString labelInfo = oneFacePath + "\\" + name  + ";"+id;
            file.write(labelInfo.toUtf8() + "\n"); 
        }
    }
    file.close();
}

3. The qdarkstyle dark style is used (to solve the problem of unsightly interface);

4. Functions include face detection, face recognition, face entry, punch-in record, release notification, etc.

2. Demonstration effect

Qt+opencv face recognition demo

1. Punch card interface: camera reading, face detection and recognition, punch card, time display, notification bar, statistical information, recognition results

2. Face input interface: basic information input, face input, model training

 3. Punch record interface: query by conditions, clear records, export records

4. Setting interface: punch time period setting, notification bar setting

Guess you like

Origin blog.csdn.net/qq_40602000/article/details/124416892