PRBonn / semantic-kitti-api

SemanticKITTI API for visualizing dataset, processing data, and evaluating results.
http://semantic-kitti.org
MIT License
783 stars 187 forks source link

Save the visualization results as PNG files in the visualization of semantic-KITTI #47

Closed KangchengLiu closed 4 years ago

KangchengLiu commented 4 years ago

How to save the visualization results as PNG files in the visualization of semantic-KITTI?

jbehley commented 4 years ago

You have to change:

https://github.com/PRBonn/semantic-kitti-api/blob/69c51072f064c85627fc97f63a10e34cfb30baa1/auxiliary/laserscanvis.py#L38 and add the keyword argument bgcolor='white' (see here in the vispy documentation))

For saving an image, one can use the render method of the Canvas to generate a numpy array (see vispy documentation). Using PIL, you should be able to save it as PNG. Something along the lines:

from PIL import Image

...

img_numpy = vis.canvas.render()
img = Image.fromarray(img_numpy)
img.save("scan.png")

See also the Pillow documentation for more information.

jbehley commented 4 years ago

issue seems to be resolved. Reopen if you need further assistance.

Jun-CEN commented 3 years ago

Hi, I got 2 questions for visualization.

First, how to close the rendering of vispy? In the scan visualization interface, I find that the color of the point will change under the different perspective.

Second, I find that the way to save images which is provided in vispy cannot save high quality images. I tried two ways: img_numpy = vis.canvas.render() img = Image.fromarray(img_numpy) img.save("scan.png") and from vispy.gloo.util import _screenshot from matplotlib import pyplot as plt img_numpy = _screenshot() plt.imshow(img_numpy) plt.savefig("scan.png", dpi=600) But the saved images are both not clear enough. @jbehley

Lzyin commented 1 day ago

Hi, I got 2 questions for visualization.

First, how to close the rendering of vispy? In the scan visualization interface, I find that the color of the point will change under the different perspective.

Second, I find that the way to save images which is provided in vispy cannot save high quality images. I tried two ways: img_numpy = vis.canvas.render() img = Image.fromarray(img_numpy) img.save("scan.png") and from vispy.gloo.util import _screenshot from matplotlib import pyplot as plt img_numpy = _screenshot() plt.imshow(img_numpy) plt.savefig("scan.png", dpi=600) But the saved images are both not clear enough. @jbehley

Hello, have you dealt with it?