Files
featherVoice/TencentCloudHuiyanSDKFace_framework/Libs/YTPoseDetector.framework/Headers/YTFaceQualityDetect.h

100 lines
2.5 KiB
C
Raw Normal View History

2025-08-08 10:49:36 +08:00
//
// Created by sunnydu on 2024/5/9.
//
#ifndef VERIFICATION_YTFACEQUALITYDETECT_H
#define VERIFICATION_YTFACEQUALITYDETECT_H
#include "DetectFaceInfo.h"
#ifdef __ANDROID__
#include <core.hpp>
#include <resize.hpp>
#include "cvtColor.hpp"
#else
#include <YTCv/core.hpp>
#include <YTCv/cvtColor.hpp>
#include <YTCv/resize.hpp>
#endif // __ANDROID__
#include <vector>
class YTFaceQualityDetect {
public:
int needFaceQualityImage = false;
float stableRoiThreshold = 0.98f;//模糊判断
float continuousShelterNumThreshold = 5;
int continuousQualityNumThreshold = 10;
// float faceMaxHeightThreshold = 0.95f;
// float faceRealMinHeightThreshold = 0.4f;
float secondaryYawThreshold = 18;
float secondaryPitchThreshold = 18;
float secondaryRollThreshold = 18;
float closeMouthThreshold = 0.4f;
float closeEyeLeftThreshold = 0.25f;//左睁眼阈值
float closeEyeRightThreshold = 0.25f;//右睁眼阈值
//人脸质量最佳帧
bool isGetImageMat = false;
yt_tinycv::Mat3BGR qualityImageMat;
std::vector<float> qualityShape;
int continuousCount = 0;
int continuousShelterCount = 0;
/**
*
*/
void resetContinuousCount();
/**
*
*/
void shelterDetect();
/**
* +1
*/
int faceQualityIsPass(DetectFaceInfo& detectFaceInfo);
private:
yt_tinycv::Rect2i previousFaceRect = yt_tinycv::Rect2i(0,0,0,0);
/**
*
*/
bool faceAngleForceCheck(DetectFaceInfo& detectFaceInfo);
/**
* (faceHeightThreshold)
* faceHeightThreshold 0
*
* @return 1
* 2
* 0
*/
int isFaceHeightStandard(DetectFaceInfo& detectFaceInfo);
/**
*
* @param shape
* @return
*/
bool isEyeOpen(DetectFaceInfo& detectFaceInfo);
/**
*
* @param detectFaceInfo
* @return
*/
bool isMouthClose(DetectFaceInfo& detectFaceInfo);
/**
*
* @param rect1
* @param outRect
*/
void getIntersectionRect(const yt_tinycv::Rect2i& rect1,yt_tinycv::Rect2i& outRect);
/**
*
* @param rect
* @return
*/
bool detectScreenShaking(const yt_tinycv::Rect2i& rect);
};
#endif //VERIFICATION_YTFACEQUALITYDETECT_H