tijiao
This commit is contained in:
parent
65e49f2967
commit
8b6aa81e00
@ -2,7 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.Views"
|
||||
StartupUri="Views/JumpRope/GroupJumpRope.xaml">
|
||||
StartupUri="Views/Home.xaml">
|
||||
|
||||
<!--StartupUri="Views/JumpRope/GroupJumpRope.xaml">-->
|
||||
<Application.Resources>
|
||||
|
||||
@ -60,6 +60,16 @@ namespace Wpf_AiSportsMicrospace.Common
|
||||
|
||||
public int VerifyWavingAction(Human human)
|
||||
{
|
||||
|
||||
var nose = human.Keypoints.FirstOrDefault(k => k.Name == "nose");
|
||||
if (nose == null)
|
||||
return 0;
|
||||
|
||||
// 使用 Canvas 宽度归一化
|
||||
double xNorm = nose.X / 1920;
|
||||
if (!(xNorm >= 0.44 && xNorm <= 0.57))
|
||||
return 0;
|
||||
|
||||
var leftWrist = human.Keypoints.FirstOrDefault(x => x.Name == "left_wrist");
|
||||
var leftElbow = human.Keypoints.FirstOrDefault(x => x.Name == "left_elbow");
|
||||
var rightWrist = human.Keypoints.FirstOrDefault(x => x.Name == "right_wrist");
|
||||
|
||||
@ -136,7 +136,7 @@ namespace Wpf_AiSportsMicrospace
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread.Sleep(5);
|
||||
Thread.Sleep(5);
|
||||
}
|
||||
}
|
||||
}, _cts.Token);
|
||||
@ -164,7 +164,6 @@ namespace Wpf_AiSportsMicrospace
|
||||
|
||||
if (human == null) return;
|
||||
|
||||
|
||||
//检测挥手动作
|
||||
var wavingaction = _sportOperate.VerifyWavingAction(human);
|
||||
|
||||
@ -174,6 +173,8 @@ namespace Wpf_AiSportsMicrospace
|
||||
|
||||
switch (wavingaction)
|
||||
{
|
||||
case 0: // 点位验证失败
|
||||
break;
|
||||
case (int)WavingAction.LeftWave: // 左手挥动
|
||||
Dispatcher.BeginInvoke(() => coverFlow.SlideRight());
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user