[vtkusers] Build depth map of a 3D model

David Doria daviddoria at gmail.com
Mon May 7 10:03:34 EDT 2012


On Mon, May 7, 2012 at 9:59 AM, Wenlong Wang <scc.wwl at gmail.com> wrote:
> Hi, Jana
>
> Thank you for your suggestion. I tried vtkWindowToImageFilter and
> SetInputBufferTypeToZBuffer(), but the application returns an error says
>
> "ERROR: In ..\..\VTK\IO\vtkBMPWriter.cxx, line 109
> vtkBMPWriter (00C53A10): BMPWriter only accepts unsigned char scalars!"
>
> I then changed the image writer to vtkJPEGWriter, but it pops similar error
> says the writer only accepts unsigned char input.
>
> I have no idea how z buffer works in vtk. Can you help me?
>
> Thank you very much. I greatly appreciate your help.
>
> Best wishes
> Wenlong

The depth buffer will be float valued. You can either use
vtkMetaImageWriter, or first round/cast the buffer to a format
(unsigned char) (using something like this:
http://www.vtk.org/doc/nightly/html/classvtkImageCast.html) that can
be written to a standard image format.

David



More information about the vtkusers mailing list