This commit is contained in:
tanglong 2025-09-22 09:40:08 +08:00
parent 37c22bfa61
commit e1937e8dde

View File

@ -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));