Possible?: Building stereo pictures and depth maps using VTK

Miller, James V (CRD) millerjv at crd.ge.com
Wed Sep 1 09:03:01 EDT 1999


The stereo images are not a problem.  Just position the camera and save off the rendered image
(SaveImageAsPPM on the render window).

As for the depth map, this can be done if you are willing to write some code and you have the
appropriate graphics hardware.  If your graphics card using a z-buffer for its opengl depth buffer,
then you use the method GetZBufferData() on the renderwindow to grab the depth values (they have been
scaled and shifted to so that 0 lies on the front clipping plane and 1 lies on the back clipping
plane).  You can then use the camera transform backwards to get quantized depth measurements.  If you
do a search through the code for GetZBufferData(), you should a couple of places in the code where we
do a similar operation.

If you don't want to take this route and you don't mind the range map generation taking a long long
long time, you could "programatically" fire off a pick over each pixel in the window (this in a
example script that does a pick operation on a number of pixels) and read back the picked position if
there was one.  This would be more exact than the zbuffer method described above, but it will takes a
very long time to complete.

Jim

-----Original Message-----
From: Mike Moran [mailto:Mike.Moran at ee.ed.ac.uk]
Sent: Tuesday, August 31, 1999 3:23 PM
To: VTK List
Subject: Possible?: Building stereo pictures and depth maps using VTK



Hi. I have a friend who needs to produce both stereo images and depth
maps for a given scene. To clarify:
- the stereo images are just two views of the same scene taken from
different viewpoints (ie not red/green stereo)
- the depth maps are images where the intensity at a point is
proportional to the distance from the camera point to the first object
it hits (think: ray tracing). Black = infinity = the ray never hits any
object, while White = distance to closest object hit by a ray. I assume
that the range of distances are scaled into the range 1 .. 255 (they are
greyscale images).

Now, I'm pretty sure VTK can do the stereo rendering, but can it do the
depth map creation? It's important that the viewpoints used in the
stereo rendering and depth map creation are the same, and it'd be easier
to ensure this if the same program/toolkit was used.

Thanks,

Mike

-- 
Mike Moran, Dept. of Electrical Engineering, The University of Edinburgh
King's Buildings, Mayfield Rd, Edinburgh EH9 3JL
(Int +44) 131 650 5665 (enquiries)
Mike.Moran at ee.ed.ac.uk


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list