linux 可视化多个所有点云与.bin格式作为视频从激光雷达-Open 3d

bttbmeg0  于 2022-11-28  发布在  Linux
关注(0)|答案(1)|浏览(240)

我通过velodyne在. bin文件中生成了几个点云,并希望以视频或动画的形式查看各种点云。
My files 000000.bin to 007480.bin are from a route with a LIDAR turned on until the end of the path and they are all in a directory called ../velodyne/ and I'm running a Deep learning model called OpenPCDet and it's time to run the demo.py with the following command:
python demo.py --cfg_file cfgs/kitti_models/pointrcnn.yaml --ckpt ../OpenPCDet/stev_models/pointrcnn_7870.pth --data_path ../OpenPCDet/data/ kitti/training/velodyne/ enter image description here the result I have is that it opens an image through the Open3D visualizer but I have to keep clicking Q (quit) or ESC to close the window and the code read the next image. My goal is to run demo.py and it will read all the .bin files at once and do the detection with OpenPCDet model treined.
https://github.com/open-mmlab/OpenPCDet/blob/master/tools/demo.py
我已经安装了你需要的一切,现在我必须运行它,如果它是一个视频已经检测到我训练的对象...

nukf8bse

nukf8bse1#

您可以修改demo.py脚本来实现这一点。Mayavi能够将图像保存为特定文件夹中的.png-s。在绘图下插入以下内容:

#import
import mayavi.mlab as mlab

#The draw scene plot already in demo.py, just to show where to insert
V.draw_scenes(points=data_dict['points'][:, 1:], ref_boxes=pred_dicts[0] 
['pred_boxes'],
ref_scores=pred_dicts[0]['pred_scores'], ref_labels=pred_dicts[0] 
['pred_labels'])
#Setting the view and distance, place this under
mlab.view(180, 85)
mlab.view(distance=40)
#Stop showing, you don't have to use Q or ESC
mlab.show(stop=True)
#Path to save the image
mlab.savefig('/home/OpenPCDet/data/prediction_results/' + 
str(i).zfill(6) + ".png")
mlab.close(all=True)

因为它被插入到for idx, data_dict in enumerate(demo_dataset)的循环中,所以它将遍历所有bin。在这之后,您可以使用另一个脚本将导出的图像连接到视频中。如下所示:https://stackoverflow.com/a/44948030/16495145
请注意,如果您对将云“转换”为png-s感到满意,这将非常有效。

相关问题