0

I am working on a project that uses kinect.

I have this main project that uses three dll's. one dll is for speech recognition made in c++, other is for pose recognition made in c++, the third dll is for gesture recognition made in c#.

Speech uses kinect audio stream, pose uses color and skeleton stream, and gesture uses skeleton stream.

Now the problem is both audio and pose dll's work together fine after initialization of kinects all three streams used, but gesture part is written in C# and it needs to reinitialize kinect's skeleton stream to use it in its skeleton ready from method.

If i only call the gesture dll it runs fine, and if i only call audio and pose without calling gesture they both also run fine.

But calling all three of them causes only the last one called (gesture or pose+audio) to run.

So please if anybody has any idea of wha the problem could be?

Fahad Rauf
  • 705
  • 2
  • 8
  • 17

1 Answers1

0

but gesture part is written in C# and it needs to reinitialize kinect's skeleton stream to use it in its skeleton ready from method.

This shouldn't need to happen. Be it the gesture or pose library, neither should need to initialize the Kinect's data streams. You should be doing all that and then you pass these libraries the data. If either of these libraries are taking on the responsibility of initializing the streams, it should be replaced.

The best example of why they shouldn't be Initializing the streams themselves is exactly what you are running into.

If one, or both, are walking over the other with initializing the skeleton stream then you will either need to get the code and fix them, use a different library or write your own. Unless there is a function in the library that just looks at data, that you missed, and doesn't initialize The stream.

Nicholas Pappas
  • 10,439
  • 12
  • 54
  • 87
  • Thanks Evil, you are right. I do have the code for gesture library, that uses KinectSensor instance to enable skeleton stream. like this 'public KinectSensor nui; this.nui.SkeletonStream.Enable(); this.nui.SkeletonFrameReady += this.OnSkeletonFrameReady;' but in c++ it uses nuiinitialize NuiInitialize(NUI_INITIALIZE_FLAG_USES_COLOR | NUI_INITIALIZE_FLAG_USES_SKELETON | NUI_INITIALIZE_FLAG_USES_AUDIO); to initialize, but i don't want multiple initializations please help – Fahad Rauf Mar 14 '13 at 03:54
  • Is the library public? If so, please provide a link and I will look at it. – Nicholas Pappas Mar 14 '13 at 05:03
  • no another person built that library that i am using. He ran into this poblem and used two kinects to run speecjh,pose on one kinect and gesture on another. He asked me to solve the problem, but problem is c++ code for pose and speech uses nuiInitialize method to initialize streams, while c# code for gesture uses KinectSensor instance, and then it enables particular stream and then calls onframeready method. – Fahad Rauf Mar 15 '13 at 02:12
  • Without looking at code, I would presume the problem is that the Kinect is being initialized twice (or more). The libraries should be written to accept data -- accepting data from the main program which captures and sends the data along to the library functions. – Nicholas Pappas Mar 15 '13 at 04:35
  • this is the main c++ initialization code `void InitializerKinect() { bool FailToConnect; do { HRESULT hr = NuiInitialize(NUI_INITIALIZE_FLAG_USES_COLOR | NUI_INITIALIZE_FLAG_USES_SKELETON | NUI_INITIALIZE_FLAG_USES_AUDIO); if (FAILED(hr)) { system("cls"); cout << "\nFailed to Connect!\n\n"; FailToConnect = true; system("PAUSE"); } else { cout << "\nConnection estableshed!\n\n"; FailToConnect = false; } } while(FailToConnect); }` – Fahad Rauf Mar 15 '13 at 06:09
  • `public void InitializeNui(){ this.UninitializeNui(); var index = 0; if (this.nui == null && index < KinectSensor.KinectSensors.Count){try{this.nui = KinectSensor.KinectSensors[index];this.nui.Start(); this.IsDisconnected = false;this.DisconnectedReason = null;}catch (IOException ex){this.nui = null;this.DisconnectedReason = ex.Message;}catch (InvalidOperationException ex){this.nui = null;this.DisconnectedReason = ex.Message;}index++;}if (this.nui != null){this.nui.SkeletonStream.Enable();this.nui.ColorStream.Enable();this.nui.SkeletonFrameReady += this.OnSkeletonFrameReady;}` – Fahad Rauf Mar 15 '13 at 06:14
  • now in this c# code, this.nui is KinectSensor, i don't know how to call skeletonfromready method without reinitializing kinect in c# code. also, i couldn't find any c++ example of gesture recognition either. – Fahad Rauf Mar 15 '13 at 06:15