简体   繁体   English

Python pptk - 屏幕截图为空

[英]Python pptk - screen capture is empty

I have a 3D point cloud that I visualize with the pptk package in python.我有一个 3D 点云,我使用 python 中的 pptk package 进行可视化。 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):它在查看器中的样子(改变了视角,因为我无法显示完整的数据):

在此处输入图像描述

What the resulting screenshot looks like:生成的屏幕截图如下所示:

在此处输入图像描述

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')

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.背景为黑色,屏幕截图中要渲染的点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM