public void Record(SkeletonFrame frame) { // Header writer.Write((int)KinectRecordOptions.Skeletons); // Data var time = DateTime.Now; TimeSpan timeSpan = time.Subtract(referenceTime); referenceTime = time; writer.Write((long)timeSpan.TotalMilliseconds); writer.Write((int)frame.TrackingMode); writer.Write(frame.FloorClipPlane.Item1); writer.Write(frame.FloorClipPlane.Item2); writer.Write(frame.FloorClipPlane.Item3); writer.Write(frame.FloorClipPlane.Item4); writer.Write(frame.FrameNumber); // Skeletons Skeleton[] skeletons = frame.GetSkeletons(); frame.CopySkeletonDataTo(skeletons); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(writer.BaseStream, skeletons); }
public ReplaySkeletonFrame(SkeletonFrame frame) { FloorClipPlane = frame.FloorClipPlane; FrameNumber = frame.FrameNumber; TimeStamp = frame.Timestamp; Skeletons = frame.GetSkeletons(); TrackingMode = frame.TrackingMode; }
/** * This method allows to record & convert in same time from KinectStreamFormat * to InMemory assimp format */ public void RecordStream(SkeletonFrame frame) { Skeleton[] skeletons = frame.GetSkeletons(); foreach (Skeleton skeleton in skeletons) { currentJoinCol = skeleton.Joints; if (skeleton.TrackingState == SkeletonTrackingState.Tracked) { KineapScene extentScene = this.GetOrCreateScene(skeleton.TrackingId, ModelType.KINECT); Scene skelScene = extentScene.Scene; // If we dont find a recorder, then we create one if (skelScene.Animations.Count == 0) { //We create the NodeHierarchy CreateNodeHierarchy(skeleton.Joints, skelScene); //We create the Animation for the Skeleton InitAnimBones(skelScene, skeleton); } else { double time = skelScene.Animations[0].DurationInTicks; foreach (Joint joint in skeleton.Joints) { this.AddJointAtTimeframeEnd(skelScene, joint, skelScene.Animations[0], time); } skelScene.Animations[0].DurationInTicks += 1; } OnFrame(new NewFrameArgs(skelScene, skelScene.Animations[0], this.currentFrame)); } } }
void ProcessFrame(SkeletonFrame frame) { Skeleton[] skeletons = frame.GetSkeletons(); foreach (var skeleton in skeletons) { if (skeleton.TrackingState != SkeletonTrackingState.Tracked) continue; _contextTracker.Add(Kinect.ToolBox.Vector.ToVector(skeleton.Position), skeleton.TrackingId); if (!_contextTracker.IsStableRelativeToCurrentSpeed(skeleton.TrackingId)) continue; foreach (Joint joint in skeleton.Joints) { if (joint.TrackingState != JointTrackingState.Tracked) continue; if (joint.JointType == JointType.HandRight) { _swipeGestureRecognizer.Add(joint.Position, _kinectSensor); } } } _skeletonManager.Draw(skeletons, _seated); }