zoukankan      html  css  js  c++  java
  • PCL基础

    博客转载自:http://www.pclcn.org/study/shownews.php?lang=cn&id=264

    许可

    建议每一个文件包含一个描述代码作者的许可,这对于用户了解使用该代码会受到何种约束是十分有用的,PCL是100%的BSD许可的,我们在文件中以C++注释的形式嵌入该许可证,详细见本章源码文件夹下License.txt。如果需要声明其他的版权,添加其他类似的内容就行了(或者原始著作权被改变)

    * Copyright (c) XXX, respective authors.

    合理命名

    到目前为止我们在例程中使用诸如setSigmaS或setSigmaR等简单的词汇来命名set和get功能的函数,在实际中,应该使用更好的命名方法,以便能够真正表示对应参数的功能,在代码的最终版本中我们将重新把setters和getters命名成set/getHalfSize和set/getStdDev以及类似的名字。

    代码注释

    PCL试图在用户和API文档方面保持高标准,支持Doxygen的文档生成的注释已经在上面的例子中删减掉。实际中,我们的bilateral.h头文件类部分如下:

    ...
    /** rief Compute the intensity average for a single point
             * param[in] pid the point index to compute the weight for
             * param[in] indices the set of nearest neighor indices
             * param[in] distances the set of nearest neighbor distances
             * 
    eturn the intensity average at a given point index
             */
    double
    computePointWeight (const int pid, const std::vector<int> &indices, const std::vector<float> &distances);
     
    /** rief Set the half size of the Gaussian bilateral filter window.
             * param[in] sigma_s the half size of the Gaussian bilateral filter window to use
             */
    inline void
    setHalfSize (const double sigma_s)
           {
             sigma_s_ = sigma_s;
           }
    ...
     #endif // PCL_FILTERS_BILATERAL_H_

    很明显比上面的代码中的注释多了不少,并且都符合一定的格式,这样就是标准的PCL编码风格了,即方便代码的维护,又方便用户的使用和学习,bilateral.hpp文件部分如下:

    ...
    // Copy the input data into the output
    output=*input_;
     
    // For all the indices given (equal to the entire cloud if none given)
    for (size_t i =0; i < indices_->size (); ++i)
       {
    // Perform a radius search to find the nearest neighbors
         tree_->radiusSearch ((*indices_)[i], sigma_s_ *2, k_indices, k_distances);
    ...
     #endif // PCL_FILTERS_BILATERAL_H_

    完成的bilateral.h和bilateral.hpp文件见本章源码文件夹下3.0文件夹。

    测试新建的类

    测试新的类很容易,我们用上面提到的第一个代码段作为例子,转而使用pcl::BilateralFilter类,利用光盘提供的CMakeLists.txt和testfilter.cpp文件,在cmake中建立工程文件,并生成相应的可执行文件,生成执行文件后,就可以运行测试前面定义的类。敬请关注PCL(Point Cloud Learning)中国更多的点云库PCL(Point Cloud Library)相关官方教程。

    参考文献:

    1.朱德海、郭浩、苏伟.点云库PCL学习教程(ISBN 978-7-5124-0954-5)北京航空航天出版社2012-10

  • 相关阅读:
    【原】ios打包ipa的四种实用方法(.app转.ipa)
    【原】Mac下统计任意文件夹中代码行数的工具——cloc
    【原+转】用CMake代替makefile进行跨平台交叉编译
    【原】iOS设计模式之:建造者模式Builder Pattern,用于改进初始化参数
    【原】Github系列之一:一起做仿天气类应用中的实时模糊效果LiveBlur
    【原】iOS:一种直接修改frame的某个属性的方法
    【原】iOS优秀开源项目总结
    【原】你真的懂iOS的autorelease吗?
    【原】iOS容易造成循环引用的三种场景,就在你我身边!
    Failure [DELETE_FAILED_INTERNAL_ERROR]之后rm apk卸载
  • 原文地址:https://www.cnblogs.com/flyinggod/p/8595733.html
Copyright © 2011-2022 走看看