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
    public void Dispose() {

      if (source != null) {
        Log("Dispose audio source");
        source.Stop();
      }

      if (Task != null) {
        Task.Dispose();
        Task = null;
      }

      if (Sensor != null) {
        Sensor.Dispose();
        Sensor = null;
      }
    }
Exemplo n.º 3
0
        public void Dispose()
        {
            if (source != null)
            {
                Log("Dispose audio source");
                source.Stop();
            }

            if (Task != null)
            {
                Task.Dispose();
                Task = null;
            }

            if (Sensor != null)
            {
                Sensor.Dispose();
                Sensor = null;
            }
        }
Exemplo n.º 4
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());

    }