TrackingNI: Depth Correction

If you’ve been following my MouseNI or TrackingNI demos, then this one is somewhat more interesting.

I had a little more free time today and thought I’d try my hand at filling in the IR shadow in the Kinect’s depth data. While it’s not perfect, there’s far less noise and the shadow of my hand is often completely unnoticeable. Overall, I would say it was a success. The left side is the original depth data, the right side is my corrected version:

This currently works by directly manipulating a WriteableBitmap, however I will probably adapt the code to correct the actual DepthMetaData object instead. Stay tuned!

Update: I still haven’t converted the code to do anything besides modify the WriteableBitmap, but it’s committed as-is right now. Feel free to check out the project from If anybody updates it, let me know!

This entry was posted in C#, Kinect, Virtual Reality and tagged , , , . Bookmark the permalink.
  • Delicious
  • Facebook
  • Reddit
  • StumbleUpon
  • Twitter
  • RSS Feed
  • Google
  • Digg

5 Responses to TrackingNI: Depth Correction

  1. Ruwan Yatawara says:

    I’ve been trying to run the code you have provided. I get this error saying.

    “C:\Program Files (x86)\OpenNI\Bin\” to “\\PIANKA_W7\Users\pianka\Desktop\TrackingNI\”. The network path was not found.

    can u pls tell me how to resolve this? thanks in advance.

  2. Ruwan Yatawara says:

    Hi, I was able to get it sorted by editing the *.csproj file..

    Code is working fine. Many Tnx. :)

  3. I apologize, I was building to another PC on my network. All you need to do is change the build path in the project settings. Glad it works though :) Feel free if you have any other questions.

  4. NathanExplosion77 says:

    I see in the MainWindow.cs file there is an array of integers called Histogram and a corresponding UpdateHistogram() Method which takes a DepthMetaData parameter but I don’t see any documentation that describes what they are doing or why. What exactly is the of the Histogram ? I see you give props to Vangos Pterneas for the functions so maybe you know if he has it documented somewhere? I have looked over several projects he has posted but your code is the first place I have seen this code.


  5. Hi NathanExplosion77,

    I believe that I got that code from here. What Pterneas’ implementation essentially builds is a cumulative histogram and normalizes it to the interval [0..255]. This helps effectively separate objects by favoring depth values that appear more frequently.

    If you have any more questions, please feel free to ask!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>