所以目前我有一个bool
PersonDetected
,总是设置为false
除非检测到骨架。但目前,SkeletonTrackingState
被标记为Tracked
,但PersonDetected
仍设为false。提前致谢
Skeleton skeletons = new Skeleton();
if ((skeletons.TrackingState == SkeletonTrackingState.Tracked ||
skeletons.TrackingState == SkeletonTrackingState.PositionOnly) &
skeletons.TrackingState != SkeletonTrackingState.NotTracked)
{
PersonDetected = true;
}
答案 0 :(得分:1)
我发现它没有注册的原因是因为skeletons
只是一个变量而不是Skeleton
被跟踪,所以我添加了以下代码以确保它有效:
Skeleton skeletons = new Skeleton();
skeletons = (from s in allSkeletons
where s.TrackingState == SkeletonTrackingState.Tracked ||
s.TrackingState == SkeletonTrackingState.PositionOnly
select s).FirstOrDefault();
if (skeletons == null)
{
return;
}
if ((skeletons.TrackingState == SkeletonTrackingState.Tracked ||
skeletons.TrackingState == SkeletonTrackingState.PositionOnly))
{
PersonDetected = true;
}
答案 1 :(得分:0)
调试“diff”。我敢打赌它高于9
之后调试部分,你正在增加diff。