Kinect Depth Smoothing, updated for Kinect for Windows SDK v1.7

The Discussion

  • User profile image
    krsanford

    Thanks for sharing Greg!

  • User profile image
    radityagumay

    Nice!, thanks for sharing

  • User profile image
    kid1412

    Thanks, very useful ^^

  • User profile image
    Apache

    Hello guys.
    Thank you very much for sharing: this is a nice piece of code for real.
    I have a question: I'm trying to translate this in C++ to have the possibility to use this with the native methods and create a library.
    I'm having troubles with the lambda expression.


    This is the C# version of the code:

    // Process each row in parallel
    Parallel.For(0, height, depthArrayRowIndex => {
    // Process each pixel in the row
    for (int depthArrayColumnIndex = 0; depthArrayColumnIndex < width; depthArrayColumnIndex++) {
    var index = depthArrayColumnIndex + (depthArrayRowIndex * width);


    and this is my C++ version:

    // We process each row in parallel
    concurrency::parallel_for(0, (int)depthWidth, [&widthBound, &heightBound, &smoothDepthArray] () {
    // Process each pixel in the row
    for (int depthArrayColumnIndex = 0; depthArrayColumnIndex < depthWidth; depthArrayColumnIndex++) {
    int depthIndex = depthArrayColumnIndex + (depthArrayRowIndex * depthWidth);

    but obviously depthArrayRowIndex is not recognized and my code is not compiling. Have you got any suggestion on how I can fix this? Probably I've not get the point on how the C# code is working: is depthArrayRowIndex a recursive call? If not, can you please explain me what is it and how can I replicate the code in C++?

    Thank you very very much !!!

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.