none
Initializing VisualGestureBuilderFrameReader with a MultiSourceFrameReader stream RRS feed

  • Question

  • I'm trying to merge code from a OpenMultiSourceFrameReader XAML example with Ben Lower's "FlappyArms" VGB console example from a few weeks ago.

    My current Windows_Loaded method looks like this:

            private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                _sensor = KinectSensor.GetDefault();
                if (_sensor != null)
                {
                    _sensor.Open();
                    _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.Infrared | FrameSourceTypes.Body);

                    vgbd = new VisualGestureBuilderDatabase("FlappyArms.gbd");
                    vgbfs = new VisualGestureBuilderFrameSource(_sensor, 0);
                    foreach (var g in vgbd.AvailableGestures)
                    {
                        myGestureList.Add(g);
                    }
                    
                    vgbfs.AddGestures(myGestureList);

                    vgbr = vgbfs.OpenReader();
                    vgbfs.GetIsEnabled(myGestureList[0]);

                    vgbr.FrameArrived += vgbr_FrameArrived;
                    _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;
                }
            }

    Both events vgbr.FrameArrived and _reader.MultiSourceFrameArrived  are triggered.  The vgbr.FrameArrived event arg is always null.  The Reader_MultiSourceFrameArrived works fine.  I suspect the line: vgbr = vgbfs.OpenReader(); is incorrect.

    What is the correct way to call visualGestureBuilderFrameSource.OpenReader if I already have a sensor source open?

    Thanks!

    Friday, August 29, 2014 3:26 AM

All replies