zhangxy0517 / 3D-Registration-with-Maximal-Cliques

Source code of CVPR 2023 paper
MIT License
421 stars 45 forks source link

feature_matching部分耗时问题的优化 #23

Open tensor-xu opened 11 months ago

tensor-xu commented 11 months ago

feature_matching函数的这个地方 pcl::PointCloud<pcl::SHOT352>::Ptr Feature_source(new pcl::PointCloud<pcl::SHOT352>); pcl::PointCloud<pcl::SHOT352>::Ptr Feature_target(new pcl::PointCloud<pcl::SHOT352>); 用pcl::SHOT35类型维度太高了吧,好多位置都填充为0了,对于FPFH特征感觉可以采用pcl::FPFHSignature33类型。大概做如下改动,测试了一帧数据,发现确实可以减少feature_matching的耗时,输出的变换矩阵也是一致的。

void feature_matching(PointCloudPtr& cloud_source, PointCloudPtr& cloud_target, vector<vector>& feature_source, vector<vector>& feature_targe, vector& Corres) { int i, j; pcl::PointCloud::Ptr Feature_source(new pcl::PointCloud); pcl::PointCloud::Ptr Feature_target(new pcl::PointCloud); Feature_source->points.resize(feature_source.size()); Feature_target->points.resize(feature_target.size()); for (i = 0; i < feature_source.size(); i++) { for (j = 0; j < 33; j++) { if (j < feature_source[i].size()) Feature_source->points[i].histogram[j] = feature_source[i][j]; } } for (i = 0; i < feature_target.size(); i++) { for (j = 0; j < 33; j++) { if (j < feature_target[i].size()) Feature_target->points[i].histogram[j] = feature_target[i][j]; } } // pcl::KdTreeFLANN kdtree; vectorIdx; vectorDist; kdtree.setInputCloud(Feature_target); for (i = 0; i < Feature_source->points.size(); i++) { kdtree.nearestKSearch(Feature_source->points[i], 1, Idx, Dist); Corre_3DMatch temp; temp.src_index = i; temp.des_index = Idx[0]; temp.src = cloud_source->points[i]; temp.des = cloud_target->points[Idx[0]]; temp.score = 1 - sqrt(Dist[0]); Corres.push_back(temp); } }

zhangxy0517 commented 11 months ago

感谢您的建议! 我们会更新对应代码