Extract color information per vertex

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Extract color information per vertex

Bing Jian
Hi vtkusers,

I have a quick question about reading the color information stored in a ply file.

The following code extracts the xyz coordinate of a given vertex, but how to read the RGB value associated to each vertex? 

vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();
reader->SetFileName("input_with_color.ply");
reader->Update();

vtkSmartPointer<vtkPolyData> polyData = reader->GetOutput();
vtkSmartPointer<vtkPoints> vertices = polyData->GetPoints();
double xyz[3];
vertices->GetPoint(idx, xyz);

I guess we can use 
polyData->GetPointData()->GetArray("???")
but not sure how to do that.  Would appreciate any pointers or examples!

Thanks,
Bing



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers