我是 kinect 编程的新手,我正在尝试映射骨架,但它无法正常工作我正在使用 1.6 版本的 kinect sdk 并且我的代码运行但是当它到达这部分时它会停止:
void kinectsensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
SkeletonFrame skeletonSet = e.OpenSkeletonFrame();
// Skeleton skeletonData = new Skeleton[kinectsensor.SkeletonStream.FrameSkeletonArrayLength];
**Skeleton skeletonData = (from s in skeletons
where s.TrackingState == SkeletonTrackingState.Tracked
select s).FirstOrDefault();**
if (skeletonData != null)
{
SetEllipsePosition(Head, skeletonData.Joints[JointType.Head]);
SetEllipsePosition(leftHand, skeletonData.Joints[JointType.HandLeft]);
SetEllipsePosition(rightHand, skeletonData.Joints[JointType.HandRight]);
ProcessGesture(skeletonData.Joints[JointType.Head], skeletonData.Joints[JointType.HandLeft], skeletonData.Joints[JointType.HandRight]);
}
}
我得到的警告信息是:
'KinectSkeletonApplication3.MainWindow.skeletons' 从未分配给,并且始终具有其默认值 null