[Paraview] 3D point cloud with color

Andrew Maclean andrew.amaclean at gmail.com
Tue Feb 21 15:30:01 EST 2012


Hi Giulio,
  I would apply a programmable filter to the data like this for
example ( it also passes through any data not used at the end - if you
have any):
#-----------------------------------
# Copy colour as (r, g, b) into a single unsigned char array.
pdi = self.GetPolyDataInput()
pdo = self.GetPolyDataOutput()
pdo.SetPoints(pdi.GetPoints())
np = pdo.GetNumberOfPoints()
a = vtk.vtkUnsignedCharArray()
a.SetNumberOfComponents(3)
a.SetNumberOfTuples(np)
a.SetName("color")
r = pdi.GetPointData().GetArray("r")
g = pdi.GetPointData().GetArray("g")
b = pdi.GetPointData().GetArray("b")
for i in range(np):
	a.SetValue(i*3, r.GetValue(i))
	a.SetValue(i*3+1, g.GetValue(i))
	a.SetValue(i*3+2, b.GetValue(i))

pdo.GetPointData().AddArray(a)

# Copy through the data we do not use.
pdo.GetPointData().AddArray(pdi.GetPointData().GetArray("px"))
pdo.GetPointData().AddArray(pdi.GetPointData().GetArray("py"))
#-----------------------------------




> From: "Giulio Reina" <giulio.reina at unisalento.it>
> To: <paraview at paraview.org>
> Cc:
> Date: Tue, 21 Feb 2012 19:44:57 +0100
> Subject: [Paraview] 3D point cloud with color
>
> Hi,
>
>
>
> I have been working with 3D stereo reconstruction. So, I have huge 3d point clouds co-registered with color in this format [X Y Z R G B] (the first three vector columns specify the location of the single point and the last three one its color in RGB space). I have been trying to display the data in Paraview without success.
>
>
>
> I use the “table to points” filter to show the 3D coordinates but then I do not know  how to specify the color of each single point using its RGB components. Can you please help me out?
>
>
>
> Cheers,
>
>
>
> Giulio
>
>


-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________


More information about the ParaView mailing list