背景介绍 最近一段时间在做点云配准的工作,使用匹配算法有PCL icp ndt gicp等,实际测试发现在某些情况下,ndt匹配精度不高,会出现错位,而ICP和GICP要求原始点云和目标点云的重合率要高,总体来说,要使配准高效、高精度,需要提供一个大概初始匹配矩阵,以及进行滤波处理,保证点云的重合率。 pcl::Registration::Ptr matcher;
matcher = ICP(source_clouds, target_clouds);
align(matcher, source_clouds, target_clouds, guess.matrix());//guess.matrix()提供初始化矩阵
考虑到即使滤波处理后点云的数量也很大,匹配时会比较耗时,所以尝试了基于ISS特征点提取的方法,实测效果还算OK。关于3D点云特征提取算法原理及对比,深蓝学院的三维点云处理第7章有介绍,包括详细的公式推导等。 ![](data:image/svg+xml;utf8,svg%20xmlns='http://www.w3.org/2000/svg'%20width='703'%20height='441'/svg) ![](data:image/svg+xml;utf8,svg%20xmlns='http://www.w3.org/2000/svg'%20width='1152'%20height='698'/svg) 算法原理 Yu Zhong提出了一种识别表示为3D点云的3D对象的新方法。引入了一种称为内在形状签名(Intrinsic Shape Signature,ISS)的新3D形状描述符,以表征点云的局部/半局部区域。固有形状签名使用与视图无关的 3D 形状表示来直接匹配来自不同视图的形状斑块,并使用编码查看几何图形的视图相关变换来促进快速姿态估计。 特征点是图像点云中那些可以通过定义检测标准提取的稳定、独特的点集,其数量远小于原始点数。ISS 特征点是一种通过与邻域信息建立联系,并利用特征值之间的关系来表示点特征程度的方法。其主要步骤如下: ![](data:image/svg+xml;utf8,svg%20xmlns='http://www.w3.org/2000/svg'%20width='1140'%20height='564'/svg) PCL代码实现#include
#include
#include
#include
#include
#include
#include
typedef pcl::PointXYZI PointType;
typedef pcl::PointCloud PointCloud;
typedef pcl::PointCloud::Ptr PointCloudPtr;
//点云可视化
// 显示model+scene以及他们的keypoints
void
visualize_pcd(PointCloudPtr model, PointCloudPtr scene_keypoints)
{
pcl::visualization::PCLVisualizer viewer("registration Viewer");
pcl::visualization::PointCloudColorHandlerCustom model_color(model, 0, 0, 255);
pcl::visualization::PointCloudColorHandlerCustom scene_keypoint_color(scene_keypoints, 255, 0, 0);
viewer.setBackgroundColor(255, 255, 255);
viewer.addPointCloud(model, model_color, "model");
viewer.addPointCloud(scene_keypoints, scene_keypoint_color, "scene_keypoints");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "scene_keypoints");
while (!viewer.wasStopped())
{
viewer.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
int main(int argc, char** argv)
{
PointCloudPtr cloud(new PointCloud);
if (pcl::io::loadPCDFile(argv[1], *cloud) == -1) // load the file
{
pcl::console::print_error("Couldn't read file %s!\n", argv[1]);
return (-1);
}
std::cout |