[OpenNI-dev] Capture hands movment with the new c# wrapper for OpenNI

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Capture hands movment with the new c# wrapper for OpenNI

Rui Marinho
Hello, will it be some kind of documentation about he methods of the
new   c# api ?  i mtrying to figure out how i can i have the hand
tracking working, i have tryed the following:

     context = new Context(SAMPLE_XML_FILE);
   this.hands = context.FindExistingNode(NodeType.Hands) as
HandsGenerator;
   this.hands.HandCreate += new
HandsGenerator.HandCreateHandler(hands_HandCreate);
            this.hands.NewDataAvailable += new
StateChangedHandler(hands_NewDataAvailable);
            this.hands.StartGenerating();
this.readerThread = new Thread(ReaderThread);
                        this.readerThread.Start();


    private unsafe void ReaderThread()
        {
            DepthMetaData depthMD = new DepthMetaData();


            while (this.shouldRun)
            {
                try
                {
                    this.context.WaitAndUpdateAll();
                   // this.context.WaitOneUpdateAll(this.depth);
                }
}
}

  void hands_NewDataAvailable(ProductionNode node)
        {

        }

        void hands_HandCreate(ProductionNode node, uint id, ref
Point3D position, float fTime)
        {

        }

but Hands create is never fired, do i need to say something else to
generador, on the other hand newdatavaible is always firing but i
don't know

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Re: Capture hands movment with the new c# wrapper for OpenNI

Chicoo
It is correct that the HandCreate is never fired. It is fired after
calling the StartTracking method on the HandsGenerator.
As an example I put the below code. This is the GestureRecognized on
the GestureHandler.

If the gesture is a Wave it will start tracking the hand.

        void _gestureGenerator_GestureRecognized(ProductionNode node,
string strGesture, ref Point3D idPosition, ref Point3D endPosition)
        {
            switch (strGesture)
            {
                case "Wave":
                    //The wave gesture is detected. If not tracking
start it.
                    if (!sessionStarted)
                    {
                        sessionStarted = true;
                        SessionStarted(this, new EventArgs());
                        hands.StartTracking(ref idPosition);
                    }
                    break;
                default:
                    break;
            }
        }


On 23 dec, 17:12, Rui Marinho <[hidden email]> wrote:

> Hello, will it be some kind of documentation about he methods of the
> new   c# api ?  i mtrying to figure out how i can i have the hand
> tracking working, i have tryed the following:
>
>      context = new Context(SAMPLE_XML_FILE);
>    this.hands = context.FindExistingNode(NodeType.Hands) as
> HandsGenerator;
>    this.hands.HandCreate += new
> HandsGenerator.HandCreateHandler(hands_HandCreate);
>             this.hands.NewDataAvailable += new
> StateChangedHandler(hands_NewDataAvailable);
>             this.hands.StartGenerating();
> this.readerThread = new Thread(ReaderThread);
>                         this.readerThread.Start();
>
>     private unsafe void ReaderThread()
>         {
>             DepthMetaData depthMD = new DepthMetaData();
>
>             while (this.shouldRun)
>             {
>                 try
>                 {
>                     this.context.WaitAndUpdateAll();
>                    // this.context.WaitOneUpdateAll(this.depth);
>                 }
>
> }
> }
>
>   void hands_NewDataAvailable(ProductionNode node)
>         {
>
>         }
>
>         void hands_HandCreate(ProductionNode node, uint id, ref
> Point3D position, float fTime)
>         {
>
>         }
>
> but Hands create is never fired, do i need to say something else to
> generador, on the other hand newdatavaible is always firing but i
> don't know

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Re: Capture hands movment with the new c# wrapper for OpenNI

Rui Marinho
Ohhh so i have to capture a gesture first?? humm thanks, let me try it
out

On 23 Dez, 22:09, Chicoo <[hidden email]> wrote:

> It is correct that the HandCreate is never fired. It is fired after
> calling the StartTracking method on the HandsGenerator.
> As an example I put the below code. This is the GestureRecognized on
> the GestureHandler.
>
> If the gesture is a Wave it will start tracking the hand.
>
>         void _gestureGenerator_GestureRecognized(ProductionNode node,
> string strGesture, ref Point3D idPosition, ref Point3D endPosition)
>         {
>             switch (strGesture)
>             {
>                 case "Wave":
>                     //The wave gesture is detected. If not tracking
> start it.
>                     if (!sessionStarted)
>                     {
>                         sessionStarted = true;
>                         SessionStarted(this, new EventArgs());
>                         hands.StartTracking(ref idPosition);
>                     }
>                     break;
>                 default:
>                     break;
>             }
>         }
>
> On 23 dec, 17:12, Rui Marinho <[hidden email]> wrote:
>
>
>
> > Hello, will it be some kind of documentation about he methods of the
> > new   c# api ?  i mtrying to figure out how i can i have the hand
> > tracking working, i have tryed the following:
>
> >      context = new Context(SAMPLE_XML_FILE);
> >    this.hands = context.FindExistingNode(NodeType.Hands) as
> > HandsGenerator;
> >    this.hands.HandCreate += new
> > HandsGenerator.HandCreateHandler(hands_HandCreate);
> >             this.hands.NewDataAvailable += new
> > StateChangedHandler(hands_NewDataAvailable);
> >             this.hands.StartGenerating();
> > this.readerThread = new Thread(ReaderThread);
> >                         this.readerThread.Start();
>
> >     private unsafe void ReaderThread()
> >         {
> >             DepthMetaData depthMD = new DepthMetaData();
>
> >             while (this.shouldRun)
> >             {
> >                 try
> >                 {
> >                     this.context.WaitAndUpdateAll();
> >                    // this.context.WaitOneUpdateAll(this.depth);
> >                 }
>
> > }
> > }
>
> >   void hands_NewDataAvailable(ProductionNode node)
> >         {
>
> >         }
>
> >         void hands_HandCreate(ProductionNode node, uint id, ref
> > Point3D position, float fTime)
> >         {
>
> >         }
>
> > but Hands create is never fired, do i need to say something else to
> > generador, on the other hand newdatavaible is always firing but i
> > don't know- Ocultar texto citado -
>
> - Mostrar texto citado -

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Re: Capture hands movment with the new c# wrapper for OpenNI

Rui Marinho
 this.gestures = context.FindExistingNode(NodeType.Gesture) as
GestureGenerator;
          this.gestures.GestureRecognized += new
GestureGenerator.GestureRecognizedHandler(gestures_GestureRecognized);


what do i need more? call    this.gestures.StartGenerating(); ??


On 26 Dez, 23:50, Rui Marinho <[hidden email]> wrote:

> Ohhh so i have to capture a gesture first?? humm thanks, let me try it
> out
>
> On 23 Dez, 22:09, Chicoo <[hidden email]> wrote:
>
>
>
> > It is correct that the HandCreate is never fired. It is fired after
> > calling the StartTracking method on the HandsGenerator.
> > As an example I put the below code. This is the GestureRecognized on
> > the GestureHandler.
>
> > If the gesture is a Wave it will start tracking the hand.
>
> >         void _gestureGenerator_GestureRecognized(ProductionNode node,
> > string strGesture, ref Point3D idPosition, ref Point3D endPosition)
> >         {
> >             switch (strGesture)
> >             {
> >                 case "Wave":
> >                     //The wave gesture is detected. If not tracking
> > start it.
> >                     if (!sessionStarted)
> >                     {
> >                         sessionStarted = true;
> >                         SessionStarted(this, new EventArgs());
> >                         hands.StartTracking(ref idPosition);
> >                     }
> >                     break;
> >                 default:
> >                     break;
> >             }
> >         }
>
> > On 23 dec, 17:12, Rui Marinho <[hidden email]> wrote:
>
> > > Hello, will it be some kind of documentation about he methods of the
> > > new   c# api ?  i mtrying to figure out how i can i have the hand
> > > tracking working, i have tryed the following:
>
> > >      context = new Context(SAMPLE_XML_FILE);
> > >    this.hands = context.FindExistingNode(NodeType.Hands) as
> > > HandsGenerator;
> > >    this.hands.HandCreate += new
> > > HandsGenerator.HandCreateHandler(hands_HandCreate);
> > >             this.hands.NewDataAvailable += new
> > > StateChangedHandler(hands_NewDataAvailable);
> > >             this.hands.StartGenerating();
> > > this.readerThread = new Thread(ReaderThread);
> > >                         this.readerThread.Start();
>
> > >     private unsafe void ReaderThread()
> > >         {
> > >             DepthMetaData depthMD = new DepthMetaData();
>
> > >             while (this.shouldRun)
> > >             {
> > >                 try
> > >                 {
> > >                     this.context.WaitAndUpdateAll();
> > >                    // this.context.WaitOneUpdateAll(this.depth);
> > >                 }
>
> > > }
> > > }
>
> > >   void hands_NewDataAvailable(ProductionNode node)
> > >         {
>
> > >         }
>
> > >         void hands_HandCreate(ProductionNode node, uint id, ref
> > > Point3D position, float fTime)
> > >         {
>
> > >         }
>
> > > but Hands create is never fired, do i need to say something else to
> > > generador, on the other hand newdatavaible is always firing but i
> > > don't know- Ocultar texto citado -
>
> > - Mostrar texto citado -- Ocultar texto citado -
>
> - Mostrar texto citado -

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Reply | Threaded
Open this post in threaded view
|

[OpenNI-dev] Re: Capture hands movment with the new c# wrapper for OpenNI

Chicoo
Yes, you need to call this.gestures.StartGenerating().
Otherwise the generator will not start recognising the gestures.
You also need to add the gestures that it must recognize:

this.gestures..AddGesture(strGesture);

You have to pass the method a valid string, otherwise you get an
error.
The valid gestures that I know are "Wave", "Click" and "RaiseHand".

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.