From 749c8a266feaf4f831d619c024f602e292701a6e Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Fri, 13 Mar 2026 16:10:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wpf_AiSportsMicrospace/Common/SportOperate.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Wpf_AiSportsMicrospace/Common/SportOperate.cs b/Wpf_AiSportsMicrospace/Common/SportOperate.cs index d6de074..49c7cb9 100644 --- a/Wpf_AiSportsMicrospace/Common/SportOperate.cs +++ b/Wpf_AiSportsMicrospace/Common/SportOperate.cs @@ -173,6 +173,9 @@ namespace Wpf_AiSportsMicrospace.Common _firstHandTriggered = false; return (int)WavingAction.RaiseHand; } + + // 举手中 + return (int)WavingAction.Raising; } /// @@ -228,7 +231,7 @@ namespace Wpf_AiSportsMicrospace.Common if (k.Name != "right_ankle" && k.Name != "left_ankle") continue; - double x = 1920 - k.X; + double x = k.X; double y = k.Y; if (Math.Abs(x - cx) <= halfW && From 458e5f725d8f8e86e97f63ae8ec165d508a5bd96 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Fri, 13 Mar 2026 13:54:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wpf_AiSportsMicrospace/Common/SportOperate.cs | 9 ++-- .../Views/JumpLong/StandingLeap.xaml.cs | 4 +- .../Views/JumpRope/GroupJumpRope.xaml.cs | 53 ++++++++++--------- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/Wpf_AiSportsMicrospace/Common/SportOperate.cs b/Wpf_AiSportsMicrospace/Common/SportOperate.cs index 49c7cb9..7d539d9 100644 --- a/Wpf_AiSportsMicrospace/Common/SportOperate.cs +++ b/Wpf_AiSportsMicrospace/Common/SportOperate.cs @@ -167,17 +167,14 @@ namespace Wpf_AiSportsMicrospace.Common } // 第二步:举手完成 - if (wristElapsed >= 3) + if (raiseElapsed >= 1) { + _raiseStartTime = null; _wristStartTime = null; _firstHandTriggered = false; return (int)WavingAction.RaiseHand; } - // 举手中 - return (int)WavingAction.Raising; - } - /// /// 验证左手动作(目前只有举手) /// @@ -231,7 +228,7 @@ namespace Wpf_AiSportsMicrospace.Common if (k.Name != "right_ankle" && k.Name != "left_ankle") continue; - double x = k.X; + double x = 1920 - k.X; double y = k.Y; if (Math.Abs(x - cx) <= halfW && diff --git a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs index 890a006..11fbc51 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs @@ -209,7 +209,7 @@ namespace Views.JumpLong // }; // TipBox.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); - // }); + // });; //}); } @@ -234,7 +234,7 @@ namespace Views.JumpLong ImageBehavior.GetAnimationController(centerImg4).Play(); await Task.Delay(2100); _sport.Stop();//关闭运动 - _mainWin.FacialRecognitionEvent -= this.HumanPredicting; + //_mainWin.FacialRecognitionEvent -= this.HumanPredicting; count.Text = counts; time.Text = _sport.GetFormatTimes(); ShowRope(); diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs index 5868a77..96c5094 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs @@ -2,6 +2,7 @@ using Common; using Dto; using Emgu.CV.Flann; +using Emgu.CV.Structure; using Enum; using HandyControl.Controls; using Microsoft.EntityFrameworkCore; @@ -66,7 +67,7 @@ namespace Wpf_AiSportsMicrospace.Views private readonly object _updateLock = new object(); private readonly Dictionary _jumpStatus = new Dictionary(); private GroupJumpRopeContext _groupJumpRopeContext; - + Image tipImage; public GroupJumpRope() { InitializeComponent(); @@ -84,11 +85,9 @@ namespace Wpf_AiSportsMicrospace.Views using var scope = App.AppHost.Services.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); - // 获取配置 - var pointCount = await db.BasicConfig - .Where(x => x.Code == AppSettings.Code) - .Select(x => x.HomeWidth) - .FirstOrDefaultAsync(); + var points = new[] { cfg.Point1, cfg.Point2, cfg.Point3, + cfg.Point4, cfg.Point5, cfg.Point6, + cfg.Point7, cfg.Point8, cfg.Point9, cfg.Point10 }; var cfg = await db.GroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code); @@ -138,13 +137,14 @@ namespace Wpf_AiSportsMicrospace.Views } private void ShowCenterTip(string imagePath, TimeSpan duration) { - var tipImage = new Image + tipImage = new Image { Source = new BitmapImage(new Uri(imagePath, UriKind.Absolute)), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Opacity = 0, Margin = new Thickness(0, -100, 0, 0), + Name= "TipImage" }; // 增加图片的大小,调整比例 @@ -164,26 +164,26 @@ namespace Wpf_AiSportsMicrospace.Views tipImage.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation); // 定时移除,并且渐变消失 - Task.Delay(duration).ContinueWith(_ => - { - Dispatcher.Invoke(() => - { - // 渐变消失动画 - var fadeOutAnimation = new DoubleAnimation - { - From = 1, - To = 0, - Duration = TimeSpan.FromSeconds(1.5) - }; - tipImage.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); + //Task.Delay(duration).ContinueWith(_ => + //{ + // Dispatcher.Invoke(() => + // { + // // 渐变消失动画 + // var fadeOutAnimation = new DoubleAnimation + // { + // From = 1, + // To = 0, + // Duration = TimeSpan.FromSeconds(1.5) + // }; + // tipImage.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); - // 完成后移除图片 - fadeOutAnimation.Completed += (s, e) => - { - userBox.Children.Remove(tipImage); - }; - }); - }); + // // 完成后移除图片 + // fadeOutAnimation.Completed += (s, e) => + // { + // userBox.Children.Remove(tipImage); + // }; + // }); + //}); } private void MediaPlayer_MediaEnded(object sender, EventArgs e) @@ -239,6 +239,7 @@ namespace Wpf_AiSportsMicrospace.Views private async void StartCountdown(int start = 3) { _mainWin.ShowCountDownAnimation(); + //_currentCountdown = start; Utils.PlayBackgroundMusic("countdown_3.mp3", false); From 64a151654a0422a103f2a8cd9e19b2d3eeaffc66 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Fri, 13 Mar 2026 16:10:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wpf_AiSportsMicrospace/Common/SportOperate.cs | 4 ++-- Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Wpf_AiSportsMicrospace/Common/SportOperate.cs b/Wpf_AiSportsMicrospace/Common/SportOperate.cs index d6de074..7d539d9 100644 --- a/Wpf_AiSportsMicrospace/Common/SportOperate.cs +++ b/Wpf_AiSportsMicrospace/Common/SportOperate.cs @@ -167,13 +167,13 @@ namespace Wpf_AiSportsMicrospace.Common } // 第二步:举手完成 - if (wristElapsed >= 3) + if (raiseElapsed >= 1) { + _raiseStartTime = null; _wristStartTime = null; _firstHandTriggered = false; return (int)WavingAction.RaiseHand; } - } /// /// 验证左手动作(目前只有举手) diff --git a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs index 890a006..11fbc51 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs @@ -209,7 +209,7 @@ namespace Views.JumpLong // }; // TipBox.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); - // }); + // });; //}); } @@ -234,7 +234,7 @@ namespace Views.JumpLong ImageBehavior.GetAnimationController(centerImg4).Play(); await Task.Delay(2100); _sport.Stop();//关闭运动 - _mainWin.FacialRecognitionEvent -= this.HumanPredicting; + //_mainWin.FacialRecognitionEvent -= this.HumanPredicting; count.Text = counts; time.Text = _sport.GetFormatTimes(); ShowRope();