Exemplo n.º 1
0
        private void InitFrames(DepthImageFrame depthFrame, ColorImageFrame colorFrame, SkeletonFrame skeletonFrame)
        {
            if (init)
            {
                return;
            }
            init = true;

            // Color Frame
            Color        = new ColorFrame();
            Color.Width  = colorFrame.Width;
            Color.Height = colorFrame.Height;
            Color.Pixels = new byte[colorFrame.PixelDataLength];
            Color.Stamp  = new Timestamp();
            Color.Fps    = FPS;
            AddOnManager.GetInstance().InitFrame(Name, Color);
            Log(Color.ToString());
            ColorFormat = colorFrame.Format;

            // Depth Frame
            Depth         = new DepthFrame();
            Depth.Width   = depthFrame.Width;
            Depth.Height  = depthFrame.Height;
            Depth.Pixelss = new short[depthFrame.PixelDataLength];
            Depth.Stamp   = new Timestamp();
            AddOnManager.GetInstance().InitFrame(Name, Depth);
            Log(Depth.ToString());

            var dueTime  = TimeSpan.FromMilliseconds(200);
            var interval = TimeSpan.FromMilliseconds(ConfigManager.GetInstance().Find("kinect_v1.motion.ms", 100));

            Task        = new MotionTask(dueTime, interval);
            Task.Device = "";
            Task.AddFrame(Depth);
            Task.Start();


            // Skeleton Frame
            Skeletons         = new BodyFrame();
            Skeletons.Width   = colorFrame.Width;
            Skeletons.Height  = colorFrame.Height;
            Skeletons.RawData = new Skeleton[6];
            Skeletons.Bodies  = new List <NBody>(6);
            Skeletons.Stamp   = new Timestamp();
            AddOnManager.GetInstance().InitFrame(Name, Skeletons);
            Log(Skeletons.ToString());
        }
Exemplo n.º 2
0
        private void StartBodyStream()
        {
            // Init infr buffer
            BodyFrame frame = Body = new BodyFrame();

            frame.Width   = Color.Width;
            frame.Height  = Color.Height;
            frame.RawData = new Body[6]; // FIXME
            frame.Bodies  = new List <NBody>(6);
            frame.Stamp   = new Timestamp();

            AddOnManager.GetInstance().InitFrame(Name, frame);
            Log(frame.ToString());

            // Start Watch
            BodyWatch = new StopwatchAvg();
        }
Exemplo n.º 3
0
    private void InitFrames(DepthImageFrame depthFrame, ColorImageFrame colorFrame, SkeletonFrame skeletonFrame) {
      if (init) { return; } init = true;

      // Color Frame
      Color = new ColorFrame();
      Color.Width = colorFrame.Width;
      Color.Height = colorFrame.Height;
      Color.Pixels = new byte[colorFrame.PixelDataLength];
      Color.Stamp = new Timestamp();
      Color.Fps = FPS;
      AddOnManager.GetInstance().InitFrame(Name, Color);
      Log(Color.ToString());
      ColorFormat = colorFrame.Format;

      // Depth Frame
      Depth = new DepthFrame();
      Depth.Width = depthFrame.Width;
      Depth.Height = depthFrame.Height;
      Depth.Pixelss = new short[depthFrame.PixelDataLength];
      Depth.Stamp = new Timestamp();
      AddOnManager.GetInstance().InitFrame(Name, Depth);
      Log(Depth.ToString());

      var dueTime = TimeSpan.FromMilliseconds(200);
      var interval = TimeSpan.FromMilliseconds(ConfigManager.GetInstance().Find("kinect_v1.motion.ms", 100));
      Task = new MotionTask(dueTime, interval);
      Task.Device = "";
      Task.AddFrame(Depth);
      Task.Start();


      // Skeleton Frame
      Skeletons = new BodyFrame();
      Skeletons.Width  = colorFrame.Width;
      Skeletons.Height = colorFrame.Height;
      Skeletons.RawData = new Skeleton[6];
      Skeletons.Bodies  = new List<NBody>(6);
      Skeletons.Stamp = new Timestamp();
      AddOnManager.GetInstance().InitFrame(Name, Skeletons);
      Log(Skeletons.ToString());

    }