[vtkusers] Export VRML to VTK ASCII format

Jose Soto sotoglzz at gmail.com
Fri Feb 26 02:27:08 EST 2016


Dear VTK users.

Hello, I'm using the kinect for scan vegetation and currently I'm working
with kinfu_remake, however this code export 3D models to a VRML file for
the Visualization Toolkit, I've never work with VTK and is very much easier
work with a .ply format or .pcd.
So, I'm trying to export this VRML file to a VTK ASCII format and then with
PCL to a .ply. I'm follow the wiki examples but I'm getting errors during
the convertion, this my code:

int main(int argc, char *argv[ ])
{
  if(argc < 3)
    {
    std::cerr << "Required arguments: input.vrml output.vtk" << std::endl;
    return EXIT_FAILURE;
    }

  std::string inputFileName = argv[1];
  std::string outputFileName = argv[2];

// Read the input
  vtkSmartPointer<vtkXMLPolyDataReader> reader =
vtkSmartPointer<vtkXMLPolyDataReader>::New();
  reader->SetFileName(inputFileName.c_str());
  reader->Update();

// Export file
  vtkSmartPointer<vtkPolyDataWriter> writer =
vtkSmartPointer<vtkPolyDataWriter>::New();
  writer->SetFileName(outputFileName.c_str());
  writer->SetFileTypeToASCII();
  writer->SetInputConnection(reader->GetOutputPort());
  writer->Update();

  return EXIT_SUCCESS;
}

So, if somebody can tell me what I'm doing wrong and give some tips or give
me a hand, that would be great

Thanks, in advance
José Soto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160226/b718b036/attachment.html>


More information about the vtkusers mailing list