0

I have a 3D point cloud that I visualize with the pptk package in python. Viewing the point cloud is no problem but as soon as I call the capture method to take a screenshot no points are visible in the resulting image.

What it looks like in the viewer (changed perspective as I can't show the full data):

enter image description here

What the resulting screenshot looks like:

enter image description here

This is the code I use to display and capture the pointcloud:

# plot the points shaded by distance
v = pptk.viewer(np.array(frame_points))
v.attributes(np.array(frame_colors))

# set point size
v.set(point_size=0.05)

# set background color
v.set(bg_color=[0, 0, 0, 0])

# remove grid
v.set(show_grid=False)

# set camera position correctly
v.set(phi=1.57072818)
v.set(theta=-1.6201359)
v.set(r=18.55500031)
v.set(lookat=[1.64106417, 1.04901338, 16.93110657])

# create screen capture
v.capture('./images/screenshot.png')
Marcus
  • 35
  • 6

1 Answers1

1

I found the solution. The code is almost correct except for this part:

# set background color
v.set(bg_color=[0, 0, 0, 0])

This needs to be

v.set(bg_color=[0, 0, 0, 1])

for the background to be black and the points to be rendered in the screenshot.

Marcus
  • 35
  • 6
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 19 '21 at 16:44
  • seems fine to me... – tdy Nov 20 '21 at 01:50