// 计算翻滚角
float getRoll(int leftEyeX, int leftEyeY, int rightEyeX, int rightEyeY)
{
float dx = rightEyeX - leftEyeX;
float dy = rightEyeY - leftEyeY;
if (fabs(dx) < 0.0000001f)
return 0.f;
else
return atanf(dx / dy)*180.0f / 3.1415926;
}
// 计算水平角
float getYaw(int noseX, int faceX, int faceWidth)
{
float dx = noseX - faceX;
float rate = dx / (faceWidth * 0.5f) - 1;
return asinf(rate)*180/3.1415926;
}
// 计算俯仰角
float getPitch(int noseY, int faceY, int faceHigh)
{
float dy = noseY - faceY;
float rate = dy / (faceHigh*0.6f) - 1;
return asinf(rate)*180/3.1415926;
}
根据5个人脸特征点,快速计算人脸角度
最新推荐文章于 2023-12-10 20:05:24 发布