// 教程官网:http://pointclouds.org/documentation/tutorials/correspondence_grouping.php#correspondence-grouping
// 添加计时
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/correspondence.h>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/features/shot_omp.h>
#include <pcl/features/board.h>
#include <pcl/filters/uniform_sampling.h>
#include <pcl/recognition/cg/hough_3d.h>
#include <pcl/recognition/cg/geometric_consistency.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/kdtree/impl/kdtree_flann.hpp>
#include <pcl/common/transforms.h>
#include <pcl/console/parse.h>
#include <pcl/common/time.h> // 计时头文件
typedef pcl::PointXYZRGBA PointType;
typedef pcl::Normal NormalType;
typedef pcl::ReferenceFrame RFType;
typedef pcl::SHOT352 DescriptorType;
std::string model_filename_;
std::string scene_filename_;
//Algorithm params
bool show_keypoints_(false);
bool show_correspondences_(false);
bool use_cloud_resolution_(false);
bool use_hough_(true);
float model_ss_(0.01f);
float scene_ss_(0.03f);
float rf_rad_(0.015f);
float descr_rad_(0.02f);
float cg_size_(0.01f);
float cg_thresh_(5.0f);
void
showHelp(char *filename) // 在控制台上打印程序可以接受的几个命令行开关的简短解释
{
std::cout << std::endl;
std::cout << "***************************************************************************" << std::endl;
std::cout << "* *" << std::endl;
std::cout << "* Correspondence Grouping Tutorial - Usage Guide *" << std::endl;
std::cout << "* *" << std::endl;
std::cout << "***************************************************************************" << std::endl << std::endl;
std::cout << "Usage: " << filename << " model_filename.pcd scene_filename.pcd [Options]" << std::endl << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " -h: Show this help." << std::endl;
std::cout << " -k: Show used keypoints." << std::endl; // 可视化构造对应点时用到的关键点
std::cout << " -c: Show used correspondences." << std::endl; // 可视化支持实例假设的对应点对
std::cout << " -r: Compute the model cloud resolution and multiply" << std::endl;// 使用点云数据的分辨率
std::cout << " each radius given by that value." << std::endl; // 设置后,其他参数值将会使用与点云分辨率相乘的结果,而非用户直接设置的值
std::cout << " --algorithm (Hough|GC): Clustering algorithm used (default Hough)." << std::endl; // 选择对应点的聚类方法
std::cout << " --model_ss val: Model uniform sampling radius (default 0.01)" << std::endl; // 模型下采样半径
std::cout << " --scene_ss val: Scene uniform sampling radius (default 0.03)" << std::endl; // 场景下采样半径
std::cout << " --rf_rad val: Reference frame radius (default 0.015)" << std::endl; // 局部参考坐标系半径
std::cout << " --descr_rad val: Descriptor radius (default 0.02)" << std::endl; // 特征描述子的半径
std::cout << " --cg_size val: Cluster size (default 0.01)" << std::endl; // 对应Hough空间分辨率或GC空间分辨率
std::cout << " --cg_thresh val: Clustering threshold (default 5)" << std::endl << std::endl; // 允许的最小聚类大小
}
void
parseCommandLine(int argc, char *argv[]) // 实际解析命令行参数,以便为执行设置正确的参数
{
//Show help
if (pcl::con
【记录】3D Object Recognition based on Correspondence Grouping
最新推荐文章于 2024-04-20 19:31:18 发布