Amit Saini
Amit Saini

Reputation: 146

how to convert the 2d image into 3d object file using vtk

how to convert the image into object file like as .obj or .ply . I need some code written in visualization toolkit and c++. Thanks

Upvotes: 0

Views: 871

Answers (1)

adsarode
adsarode

Reputation: 46

Image data is pixel data and .obj/ .ply or for that matter .stl is 3D geometry data with Point and Cell (for .obj Cell is Triangle) information.

Your question is not clear, but to give you some steps -

  1. First, you need to identify how would you convert the pixels into points? vtkImageDataGeometryFilter might be of help here. Although it might not be sufficient as you will also need triangles data.
  2. Once you get vtkPolyData from image data, you can write this data to STL or OBJ or PLY format. You can use following VTK classes for that vtkSTLWriter, vtkOBJWriter and vtkPLYWriter.

Upvotes: 1

Related Questions