how to store and keep skeleton data (access,read write...)? RRS feed

  • Question

  • hi kinect community guys,

    I have a question and I am sure somebody has faced this before. I will appreciate your suggestions.

    I am working with kinect's skeleton data (joint position information). kinect gives us information of 20 joints in each frame but I need to keep variable number of frames in memory (let's say 2000 frame) and then manipulate it, read and write on it, apply different algorithms on it.

    what is the best method in your idea to keep these frames information (consider simultaneous read/write, threads ..). what I found so far is Concurrency class and I want to add each frame into a concurrent vector or queue like:

    Concurrency::concurrent_vector<NUI_SKELETON_DATA> skeletonFrameQueue;


    that is what I came up with but sometime I have runtime errors and program crashes and it is about heap.

    what do you think and what do you suggest about storing these data? is concurrent vectors ok? does they secure with threads? or what is other options ?

    thanks in advance for your suggestions.


    Sunday, May 5, 2013 8:01 PM

All replies

  • Hi farhood,
    use threads ;)

    For new standard concurrency features in Visual C++ 11 read this article:

    For performance tuning see the Concurrency Visualizer in Visual Studio. 
    Monday, May 6, 2013 8:25 PM
  • Hi Clemente,

    thank you for your useful links, specially the concurrency analyzer is a great tool that I learned to use it.

    but I should say that I already use threads. one I create for OpenGL and the others for Skeleton and depth tracking processes of the kinect.

    but I see lags and screen stutters, after using concurrency analyzer I think there are too many context switches.(I should mention that the only action about threads that I am doing is createThread and I am not doing anything about managing them).

    so I have something like this:



            if(Do initialization of opengl and kinect and start kinect color,depth and skeleton threads)




                    while (true)
                    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
                        if (msg.message == WM_QUIT)


                    if (msg.message == WM_QUIT)

                    if (openglWindow_hasFocus)


    there is a point worth to mention that when I set a Sleep(1); at the end of the Got_skeleton() and Got_depth() threads most of the lags go away but I still have some. I thought maybe it helps synchronization. but more values of sleep like 10ms or 20ms doesn't work well. there must be a point here I miss.

    insights ?


    Friday, May 10, 2013 12:07 PM