[vtkusers] Distance between camera and visible pixel (depth information/map)

Lisa S. Avila lisa.avila at kitware.com
Mon Nov 25 22:49:29 EST 2002


Hello David,

The values returned by GetZ() are the actually z buffer values which range 
from 0 at the near plane and 1 at the far plane. They are evenly spaced for 
orthographic projections, but that is not true for perspective projections. 
You can convert the (x,y) position of the pixel with the Z value back into 
a world coordinate using the transformation methods in the renderer - use 
DisplayToWorld. This won't be fast but you can get your image.

Lisa


At 03:32 PM 11/25/2002, David Kornmüller wrote:
>hello,
>
>I have a problem and I couldn't find an answer. I want to compute the
>distance between a camera and a visible object (like a depth map). Is this
>possible and how?
>
>In my case I want to simulate a rangefinder, which computes the distance to
>the next visible object. Then the best would be, if I get the range-data in
>the coordinate system I put the actors in the scene (e.g. I have a cylinder
>with a radius 8. I put the camera in the middle of the cylinder and then I
>want
>to get the distance information 8).
>
>I found a method in the vtkRenderer class called "GetZ(int x, int y)". I
>thought that could be the solution. But I only get Z values between 0 and 1
>(mainly something like 0.9.....). Maybe is it possible to convert this data
>into
>values I put the actors in the scene? (like in the example above that I get
>values between 0 and 8 - depending if there is maybe another object in this
>cylinder)
>
>I hope someone can help me because I really need this range information.
>cheers,
>david
>
>--
>+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
>NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers






More information about the vtkusers mailing list