123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef CFACERECPROC_H
- #define CFACERECPROC_H
- #include "opencv2/opencv.hpp"
- #include "seeta/FaceDetector.h"
- #include "seeta/FaceLandmarker.h"
- #include "seeta/FaceRecognizer.h"
- #include "seeta/PoseEstimator.h"
- #include "seeta/FaceAntiSpoofing.h"
- #include "seeta/EyeStateDetector.h"
- #include <QString>
- #define SL_FACE_DETECT 999
- #define SL_MOUTH_OPEN 1
- #define SL_HEAD_LEFT 3//!< 向左转头
- #define SL_HEAD_RIGHT 4//!< 向右转头
- #define SL_HEAD_UP 5//!< 抬头
- #define SL_HEAD_DOWN 6//!< 低头
- #define SL_EYE_CLOSE 10//!< 闭眼
- #define SL_EYE_OPEN 11//!< 睁眼
- enum
- {
- NO_FACE,
- BLUR,
- DARK,
- BRIGHT,
- ANGLE_TOOLARGE
- };
- class CFaceRecProc
- {
- public:
- CFaceRecProc();
- ~CFaceRecProc();
- QString errorMsg();
- bool getFaceCount(cv::Mat faceMat, int &nFaceCount);
- bool getFaceCount(QString sFaceImage, int &nFaceCount);
- bool getFaceAttribute(QString sFaceImage, int nFaceStatus, bool &bHasStatus, int &nFaceCount);
- bool getFaceAttribute(cv::Mat faceMat, int nFaceStatus, bool &bHasStatus, int &nFaceCount);
- /*fYaw 绕Y轴, fPitch垂直 绕x轴, fRoll 绕z轴 角度
- * y z
- * | /
- fYaw | /fRoll
- |/____x fPitch
- */
- bool getFaceAttribute(cv::Mat faceMat, float &fYaw, float &fPitch, float &fRoll, int &nFaceCount);
- bool faceCompare(cv::Mat faceMat, cv::Mat baseMat, int &nfaceCount, float &fScore);
- bool faceCompare(QString sFaceImage, QString sBaseImge, int &nfaceCount, float &fScore);
- bool setBaseImage(cv::Mat baseMat);
- bool setBaseImage(QString sBaseImge);
- bool compareWithBase(cv::Mat faceMat, int &nfaceCount, float &fScore);
- bool compareWithBase(QString sFaceImage, int &nfaceCount, float &fScore);
- bool faceRealness(cv::Mat faceMat, bool &bRealness);
- bool compareWithBase(cv::Mat faceMat, int &nfaceCount, float &fScore, SeetaRect &rt);
- bool compareWithBase(cv::Mat faceMat, int &nfaceCount, float &fScore, bool &bEyeClose);
- bool compareWithBase(cv::Mat faceMat, int &nfaceCount, float &fScore, bool &bEyeClose, bool bIsCampare, bool bIsCheckEye);
- bool compareWithBaseRealness(cv::Mat faceMat, int &nfaceCount, float &fScore, bool &bRealness);
- bool getMaxFaceScoreWithBase(cv::Mat faceMat, int &nfaceCount, float &fScore, bool &bRealness, int &nTime);
- bool hasBaseImage();
- float* getFeature();
- void setBaseFeature(float *feature);
- private:
- int InitHandle(std::string model_path);
- void destroyHandle();
- seeta::FaceDetector *m_pFaceDetector;//人脸检测
- seeta::FaceLandmarker *m_pFaceLandmarker;//特征值
- seeta::FaceRecognizer *m_pFaceRecognizer;//人脸识别
- seeta::PoseEstimator *m_pPoseEstimator;//姿态
- seeta::FaceAntiSpoofing *m_pFaceAntiSpoofing;//真实性
- seeta::EyeStateDetector *m_pEyeStateDetector;
- std::shared_ptr<float> m_baseFeaturePtr;
- QString m_sErrMsg;
- };
- extern std::shared_ptr<CFaceRecProc> g_faceRecProcPtr;
- #endif // CFACERECPROC_H
|