Exemplo n.º 1
0
 public ColorFrameDumper(KinectSource kinectSource, string colorDataOutputFile)
 {
     // open file for output
     try
     {
         _colorOutputStream = new BufferedStream(new FileStream(colorDataOutputFile, FileMode.Create));
     }
     catch (Exception e)
     {
         Console.Error.WriteLine("Error opening output file: " + e.Message);
         Close();
         throw;
     }
     kinectSource.ColorFrameEvent += HandleColorFrame;
 }
        /// <summary>
        /// Create a new body frame dumper that dumps first tracked Body data to a csv file.
        /// </summary>
        /// <param name="kinectSource"></param>
        /// <param name="outputFileName"></param>
        public BodyFrameDumper(KinectSource kinectSource, string outputFileName)
        {
            // open file for output
            try
            {
                _bodyOutputStream = new StreamWriter(new BufferedStream(new FileStream(outputFileName, FileMode.Create)));

                // write header
                _bodyOutputStream.WriteLine(
                    "# timestamp, jointType, position.X, position.Y, position.Z, orientation.X, orientation.Y, orientation.Z, orientation.W, state");
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error opening output file: " + e.Message);
                Close();
                throw;
            }
            kinectSource.BodyFrameEvent += HandleBodyFrame;
            kinectSource.FirstFrameRelativeTimeEvent += ts => InitialTime = ts;
        }