From e1937e8dde30215becd9b9491e26f1b5b7251485 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Mon, 22 Sep 2025 09:40:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wpf_AiSportsMicrospace/MainWindow.xaml.cs | 56 +++++++++++------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/Wpf_AiSportsMicrospace/MainWindow.xaml.cs b/Wpf_AiSportsMicrospace/MainWindow.xaml.cs index 2158be4..f9cd20c 100644 --- a/Wpf_AiSportsMicrospace/MainWindow.xaml.cs +++ b/Wpf_AiSportsMicrospace/MainWindow.xaml.cs @@ -157,7 +157,7 @@ public partial class MainWindow : Window _webcamClient.OnExtractFrame += this.OnFrameExtracted; _webcamClient.StartExtract();//开始抽帧 - + this.startOrStop.Content = "停止(&S)"; this.sportCounts.Text = "0"; @@ -211,36 +211,34 @@ public partial class MainWindow : Window _videoBitmap.Unlock(); }); + //var actualPositions = new List<(double X, double Y)> + //{ + // (290, 510), + // (500, 700), + // (810, 710), + // (120, 880), + // (350, 880), + // (660, 880) + //}; + ////判断是否出圈 + //if (configService.ConfigDic.TryGetValue("JumpRope", out var obj) && obj is ConfigSet cfg) + //{ + // for (int i = 0; i < actualPositions.Count && i < cfg.Points.Count; i++) + // { + // var (ax, ay) = actualPositions[i]; + // var pointCfg = cfg.Points[i]; - var actualPositions = new List<(double X, double Y)> - { - (290, 510), - (500, 700), - (810, 710), - (120, 880), - (350, 880), - (660, 880) - }; - - //判断是否出圈 - if (configService.ConfigDic.TryGetValue("JumpRope", out var obj) && obj is ConfigSet cfg) - { - for (int i = 0; i < actualPositions.Count && i < cfg.Points.Count; i++) - { - var (ax, ay) = actualPositions[i]; - var pointCfg = cfg.Points[i]; - - if (!IsInsideCircle(ax, ay, pointCfg)) - { - Console.WriteLine($"⚠️ 学生{i + 1} 已经出圈!(坐标 {ax},{ay})"); - } - else - { - Console.WriteLine($"✅ 学生{i + 1} 在圈内。"); - } - } - } + // if (!IsInsideCircle(ax, ay, pointCfg)) + // { + // Console.WriteLine($"⚠️ 学生{i + 1} 已经出圈!(坐标 {ax},{ay})"); + // } + // else + // { + // Console.WriteLine($"✅ 学生{i + 1} 在圈内。"); + // } + // } + //} //可以进一步进行人体识别等 //var humanResult = await Task.Run(() => _humanPredictor.Predicting(buffer, frame.Number));