前言
抛开算法层面不谈,要利用PCL库中PCLVisualizer可视化类,显示出不同模型并对模型做出不同渲染,制作出丰富的可视化效果以增强自己应用的功能。下面将对如何添加立方体模型和圆球模型到视窗并渲染进行一个大概描述。
立方体模型
//向视窗添加一个立方体模型并渲染,只显示线框。若不要显示线框将下面一行代码注释即可。
viewer->addCube(0.1, 0.2, 0.1, 0.2, 0.1, 0.2);
viewer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_REPRESENTATION, pcl::visualization::PCL_VISUALIZER_REPRESENTATION_WIREFRAME,"cube");
PCL Docs
bool addCube (const pcl::ModelCoefficients &coefficients, const std::string &id="cube", int viewport=0)
bool addCube (const Eigen::Vector3f &translation, const Eigen::Quaternionf &rotation, double width, double height, double depth, const std::string &id="cube", int viewport=0)
bool addCube (float x_min, float x_max, float y_min, float y_max, float z_min, float z_max, double r=1.0, double g=1.0, double b&