示例#1
0
        public void Record(ReplaySkeletonFrame frame)
        {
            if (writer == null)
                throw new Exception("This recorder is stopped");

            if (replayrecorder == null)
                throw new Exception("Skeleton recording is not actived on this KinectRecorder");

            replayrecorder.Record(frame);
        }
        public void Record(ReplaySkeletonFrame frame)
        {
            // Header
            writer.Write((int)KinectRecordOptions.ReplayFrame);

            // Data
            TimeSpan timeSpan = DateTime.Now.Subtract(recordingTime);
            recordingTime = DateTime.Now;
            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.Skeletons;

            BinaryFormatter formatter = new BinaryFormatter();
            formatter.Serialize(writer.BaseStream, skeletons);
        }