I am trying to synthetically generate depth image mimicing a real Kinect. So I have set the camera params as below using python script.

enter image description here

I have setup the nodes and able to get the depth image as shown below. Along with render params as shown in the figure. I am able to render the depth image. enter image description here

But when I read the image outside, there is a cutoff after certain depth. This can be seen in the below matlab read of the image. One can see that the top rows in the image are set to constant high values. enter image description here

When I change the viewpoint of the camera to be lower, it seems to gradually improve gradienting. So I believe its having a threshold which says beyond this z value, if there is an object then just assign the highest value or something. I played around with all the camera params and couldn't figure out the issue. Please let me know if you have come across this or know of any parameter that can fix this.

Thanks in advance!

  • 1
    be sure that the limitation in blender : click on the render result image in the UV_Editor and read the values of RGB to be sure, you can normalize the Z depth with Vector_Normalize node and use a HSV color ramp to get the final view inside blender – Chebhou Jul 2 '15 at 4:31
up vote 4 down vote accepted

The values of the Z Buffer are in float values, and then they get clipped to <0,1> (<0,255>) range in your file format.

  • Either save the images in some hdr format (.exr for example) that will support float values

  • or re-map the values to the <0,1> range yourself with Map Value node.

  • Can you point me to something where I can know how access the float values from the .exr format? – desinghkar Jul 6 '15 at 20:22
  • @desinghkar You can view the exact RGB values under the mouse cursor in UV/ImageEditor when you right-click. – Jaroslav Jerryno Novotny Jul 7 '15 at 8:58
  • Hey thanks! But the reason I am using the blender is to get render the zbuffer out into a file that I can use for non-visualization purpose. So basically I need the depth values. I am writing them out to .hdr file and getting it now. But I would like to know if I can use python scripting to get to the object that holds these values when I render it out. Because I again have to read the .hdr files into a text file to get hold of these values for my project. – desinghkar Jul 9 '15 at 2:09
  • @desinghkar yep you can do this with python. You can render and then access the pixel values and write them into txt or json with single python script. Here is how: blender.stackexchange.com/questions/2170/… – Jaroslav Jerryno Novotny Jul 9 '15 at 6:22
  • Thanks for the comments. But is there a way to actually access the Z-values directly off the nodes rather than trying to access the pixels. I have that rendered as HDR images on disk. But I don't want to save it on the disk anymore and want to access the values. Can you tell me if there is way to do that. – desinghkar Jan 29 '16 at 17:31

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.