How do I get the depth data in c#

How do I get the depth data in c#

Hello all

I need to get the depth data (not bitmap) in C#, can you help me ?


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Kobi, Depth map image is constructed from depth data. Logic is very simple. The more closer object is, intensity value will be higher. Depth is the distance from camera here.  your values will vary from 0-255. So first Take an object away from camera till it is vanished from depth image. Say that distance is dmin. Now take it closer to camera. Say that is dmax.

so (dmax-dmin)=255;

Now you basically can calliborate from every pixel value, the exact distance of the object from camera. 

I assume, you are trying in XNA. Use  pointer unsafe based GDI to loop through image pixel and construct your Depth matrix. 

I do not know if there are better ways, but I am using it quite effectively.

Thank you, I used the data from the bitmap convertet into Texture2D using your code, and I get the data.

The problem is the data is normalized and I need the raw data.

Leave a Comment

Please sign in to add a comment. Not a member? Join today