I am part of a research group doing some work in graphics. I would like to export the depth information as an image/text file using a python script. I have been googling this for quite a few days and I still have not got anything that actually works.
Waiting for your response,
Render your scene to OpenEXR format and enable the ZBuf option. I think I've had trouble in the past with some programs reading this multilayer EXR format. For example, while Photoshop supports the EXR files that Blender generates with ZBuf disabled, I had to install a plugin to open the multilayer version.
I usually split the EXR files outside of Blender. For this I use the OpenEXR package. http://pypi.python.org/pypi/OpenEXR/1.2.0
Here's a snippet to get you started. It uses numpy arrays to store the data. Originally adapted from http://opencv.willowgarage.com/documentation/python/cookbook.html#opencv-and-openexr.
# your filename here
exrimage = OpenEXR.InputFile(filename)
dw = exrimage.header()['dataWindow']
(width, height) = (dw.max.x - dw.min.x + 1, dw.max.y - dw.min.y + 1)
mat = numpy.fromstring(s, dtype=numpy.float16)
mat = mat.reshape (height,width)
pt = Imath.PixelType(Imath.PixelType.HALF)
(r, g, b, a, z) = [fromstr(s) for s in exrimage.channels('RGBAZ', pt)]
I found another method to do the same. Slightly round about but works just the same.
Thanks anyways for your reply.