none
DepthImagePoint point value = 0 System.NullReferenceException RRS feed

  • Question

  • Hi, I have a problem with my Kinect Application.

    I have 4 window in my application, but when I close the first an open the second form, I have an exception:

    An unhandled exception of type 'System.NullReferenceException" at this line:

    DepthImagePoint point = this.Kinect.CoordinateMapper.MapSkeletonPointToDepthPoint(mano.Position, DepthImageFormat.Resolution640x480Fps30);

    I declare DepthImage point in a method private:

      private void TrackingMano(Joint mano)
            {
                if (mano.TrackingState == JointTrackingState.NotTracked) //se la mano non è individuata non faccio visualizzare l'hover button
                {
                    kinectButton.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    kinectButton.Visibility = System.Windows.Visibility.Visible;

                    DepthImagePoint point = this.Kinect.CoordinateMapper.MapSkeletonPointToDepthPoint(mano.Position, DepthImageFormat.Resolution640x480Fps30);
                
                    Xmano = (int)((point.X * LayoutRoot.ActualWidth / this.Kinect.DepthStream.FrameWidth) -
                        (kinectButton.ActualWidth / 2.0));
                    Ymano = (int)((point.Y * LayoutRoot.ActualHeight / this.Kinect.DepthStream.FrameHeight) -
                        (kinectButton.ActualHeight / 2.0));
                    Canvas.SetLeft(kinectButton, Xmano);
                    Canvas.SetTop(kinectButton, Ymano);

                
                }
            }

    But when I clik my start button (button "INIZIO")

      private void btnInizio_Click(object sender, RoutedEventArgs e)
            {
               
                this.Close();
                OrientamentoTemporale1.Show(); //the next window
                    
            }

    i have the exception, I note that the point value is 0....

    Friday, January 25, 2013 10:49 AM