转载:https://blog.csdn.net/minus/article/details/120020027
精准详细的计算可以参考:https://blog.csdn.net/u014090429/article/details/100762308
// 计算翻滚角 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; }
标签:return,int,float,rate,角度,人脸,dx,dy,转载 From: https://www.cnblogs.com/hansjorn/p/17805493.html