目录
二,pcl::visualization::PCLVisualizer
viewer.setPointCloudRenderingProperties
setPointCloudRenderingProperties()
一, makeShared:使点云返回一个智能指针(深拷贝)
/** \brief Copy the cloud to the heap and return a smart pointer
* Note that deep copy is performed, so avoid using this function on non-empty clouds.
* The changes of the returned cloud are not mirrored back to this one.
* \return shared pointer to the copy of the cloud
*/
inline Ptr
makeShared () const { return Ptr (new PointCloud<PointT> (*this)); }
二,pcl::visualization::PCLVisualizer
viewer.setPointCloudRenderingProperties
setPointCloudRenderingProperties()
bool pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties (
int property,
double value,
const std::string & id = "cloud",
int viewport = 0
)
Set the rendering properties of a PointCloud.
Parameters
[in] | property | the property type |
[in] | value | the value to be set |
[in] | id | the point cloud object id (default: cloud) |
[in] | viewport | the view port where the Point Cloud's rendering properties should be modified (default: all) |
Note
注意事项:
设置属性前需要指定id,默认为“cloud”,如果没有设置“cloud”的id,或者其他id,将不起作用。
The list of properties can be found in pcl::visualization::LookUpTableRepresentationProperties.
三,RenderingProperties
enum pcl::visualization::RenderingProperties |
Set of rendering properties.
Enumerator | |
---|---|
PCL_VISUALIZER_POINT_SIZE | integer starting from 1 |
PCL_VISUALIZER_OPACITY | Float going from 0.0 (transparent) to 1.0 (opaque) |
PCL_VISUALIZER_LINE_WIDTH | Integer starting from 1. |
PCL_VISUALIZER_FONT_SIZE | |
PCL_VISUALIZER_COLOR | 3 floats (R, G, B) going from 0.0 (dark) to 1.0 (light) |
PCL_VISUALIZER_REPRESENTATION | |
PCL_VISUALIZER_IMMEDIATE_RENDERING | |
PCL_VISUALIZER_SHADING | |
PCL_VISUALIZER_LUT | colormap type pcl::visualization::LookUpTableRepresentationProperties |
PCL_VISUALIZER_LUT_RANGE | two doubles (min and max) or PCL_VISUALIZER_LUT_RANGE_AUTO |
四, 添加文本addText、updateText
/** \brief Add a text to screen
* \param[in] text the text to add
* \param[in] xpos the X position on screen where the text should be added
* \param[in] ypos the Y position on screen where the text should be added
* \param[in] fontsize the fontsize of the text
* \param[in] r the red color value
* \param[in] g the green color value
* \param[in] b the blue color value
* \param[in] id the text object id (default: equal to the "text" parameter)
* \param[in] viewport the view port (default: all)
*/
bool
addText (const std::string &text, int xpos, int ypos, int fontsize, double r, double g, double b,
const std::string &id = "", int viewport = 0);
五,点云分割
getColoredCloud()
如果云被成功分割,则函数返回彩色云。否则返回一个空指针。属于同一段的点具有相同的颜色。但是这个函数并不能保证不同的片段会有不同的颜色(这完全取决于RNG)。未在索引数组中列出的点将用红色表示。
六, 经验总结
在Visual Studio中使用Release模式运行速度更快,如果是为了运行程序,而不是调试,尽量选择Release模式,而不是Debug模式。