2023-11-10 07:17:23 +00:00
|
|
|
|
using OpenCVForUnity.CoreModule;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
public class HeadTurnDown : PoseBase
|
|
|
|
|
{
|
|
|
|
|
public override bool CheckPose(List<Point> points)
|
|
|
|
|
{
|
2023-11-13 02:53:34 +00:00
|
|
|
|
// 必须包含 Nose 和 LEar 和 Neck 的点位
|
|
|
|
|
if (!YogaManager.Instance.ActionCheckPoints(points))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var basePoint = YogaManager.Instance.Points;
|
|
|
|
|
if (!YogaManager.Instance.ActionCheckPoints(basePoint))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var noseMagnitude = ("Nose".vector(points) - "Neck".vector(points)).magnitude;
|
|
|
|
|
var noseBaseMagnitude = ("Nose".vector(basePoint) - "Neck".vector(basePoint)).magnitude;
|
|
|
|
|
|
2023-11-13 06:43:34 +00:00
|
|
|
|
if (noseBaseMagnitude > noseMagnitude * 1.1f)
|
2023-11-13 02:53:34 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
2023-11-10 07:17:23 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|