Thursday, March 29, 2012

Problem with Kinect SDK and WPF dispatcher

I'm trying to get to run the WPF samples for Candescent NUI with the Kinect SDK. I'm experiencing a strange problem. When processing a depth frame (in the event DepthFrameReady) I experience performance issues and sometimes even a stack overflow exception.

Here's a stacktrace. You'll notice that after calling the WPF dispatcher the DepthFrameReady event is called again, and again ... resulting in a stack overflow exception

My guess is that while I'm processing a depth frame a new frame becomes available. When I give control to the dispatcher it somehow processes the message queue and first continues with the new depth frame instead of the code I pass.

So I see two solutions
1. Make my code faster so it's done when the new frame gets ready. But I can't guarantee this.
2. Create a queue for the depth frames and process them in a separate thread. Maybe dropping some frames when my code is too slow.

Is there information available on how this should be handeled? Might have to ask in the forum...

Tuesday, March 13, 2012

Candescent NUI for Kinect For Windows (13564)

I've finally got hold of a Kinect For Windows device today. I've updated Candescent NUI to use the near mode. It should now perform for both OpenNI and Kinect SDK (excluding the Kinect for XBOX devices, because of the missing near mode).

You can download the [source] or [binary]

The CCT.NUI.Samples project works for both OpenNI and Kinect For Windows. I still have to enable the WPF samples for Kinect SDK; that'll probably happen next weekend.

I also definitely want to start playing with the audio features!

Sunday, March 11, 2012

Candescent NUI 13501

After a pause I've continued to work on Candescent NUI. I've simplified the contour tracing algorithm. The contour scanning step isn't necessary anymore. This speeds up hand detection by 20-30%.

Other changes:
- Fixed the Test Data Collector
- Sped up finding the center of palm a bit
- Added the video manipulation sample code (won't win any clean code award)
- Changed some parameters and values

To enable video manipulation you'll have to replace these values in wpfsamples.exe.config with paths to videos on your system (WPF has to be able to play them):