PCL点云库可视化常用函数与经验总结

目录

一, makeShared:使点云返回一个智能指针(深拷贝)

二,pcl::visualization::PCLVisualizer

viewer.setPointCloudRenderingProperties

setPointCloudRenderingProperties() 

Note

三,RenderingProperties

四, 添加文本addText、updateText

五,点云分割

getColoredCloud()

六, 经验总结


一, 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]propertythe property type
[in]valuethe value to be set
[in]idthe point cloud object id (default: cloud)
[in]viewportthe 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模式。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SOC罗三炮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值