Extract color information per vertex
Bing Jian <[email protected]> Thu, 9 May 2019 16:38:24 -0700
| Newsgroups | gmane.comp.lib.vtk.user |
|---|---|
| Message-ID | <CAHPmMT=hjW9smZtAWFZ+GUxn=ts_AOfdK_JFtm8soHV-+iqNwQ@mail.gmail.com> |
--===============1232001425==
Content-Type: multipart/alternative; boundary="000000000000d381ff05887cf229"
--000000000000d381ff05887cf229
Content-Type: text/plain; charset="UTF-8"
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
--000000000000d381ff05887cf229
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">Hi vtkusers,<div><br></d=
iv><div>I have a quick question about reading the color information stored =
in a ply file.</div><div><br></div><div>The following code extracts the xyz=
coordinate of a given vertex, but how to read the RGB value associated to =
each vertex?=C2=A0</div><div><br></div><div><div><div>vtkSmartPointer<vt=
kPLYReader> reader =3D vtkSmartPointer<vtkPLYReader>::New();</div>=
<div>reader->SetFileName("input_with_color.ply");</div><div>re=
ader->Update();</div><div><br></div><div>vtkSmartPointer<vtkPolyData&=
gt; polyData =3D reader->GetOutput();</div><div>vtkSmartPointer<vtkPo=
ints> vertices =3D polyData->GetPoints();</div><div>double xyz[3];</d=
iv><div>vertices->GetPoint(idx, xyz);</div></div></div><div><br></div><d=
iv>I guess we can use=C2=A0</div><div>polyData->GetPointData()->GetAr=
ray("???")<br></div><div>but not sure how to do that.=C2=A0 Would=
appreciate any pointers or examples!</div><div><br></div><div>Thanks,</div=
><div>Bing</div><div><br></div><div><div><br></div></div></div></div></div>
--000000000000d381ff05887cf229--
--===============1232001425==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
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
--===============1232001425==--