使用open3d做点云可视化时需要一些额外设置才能够有更好的效果。visualization::DrawGeometries这种原始的绘制方法通常不满足要求,因为颗粒度太粗,且无法做其它渲染设置。
// draw a coordinate frame
std::shared_ptr<open3d::geometry::TriangleMesh> coord_frame = open3d::geometry::TriangleMesh::CreateCoordinateFrame(100);
// down smaple the pointcloud
std::shared_ptr<open3d::geometry::PointCloud> down_sampled_points = point_cloud->RandomDownSample(0.01);
// visualize the downsampled pointcloud
open3d::visualization::Visualizer down_sample_vis;
down_sample_vis.CreateVisualizerWindow("down sampled vis");
// get the vis window rendering option
open3d::visualization::RenderOption& render_opt= down_sample_vis.GetRenderOption();
// set the point rendering size
render_opt.SetPointSize(0.1);
// set the rendering background color
render_opt.background_color_ = Eigen::Vector3d(0,0,0);
down_sample_vis.AddGeometry(down_sampled_points);
down_sample_vis.AddGeometry(coord_frame);
down_sample_vis.Run();