PCL 返回的 IterativeClosestPoint class 中的 getFitnessScore() 是什么单位?
What unit is `getFitnessScore()` in the IterativeClosestPoint class from PCL returning?
我使用点云库中的 pcl::IterativeClosestPoint
方法。
截至目前,它的文档似乎处于离线状态。
这里在googlecache. And also a tutorial.
可以调用 icp.getFitnessScore()
来获取到两个云点的均方距离。我只是找不到关于这表明哪种单位的信息。有谁知道我得到的数字是什么意思?例如,我的输出是:0,0003192
。好像有点小,不知道是米,厘米,英尺还是别的什么。
非常感谢。
what kind of unit is icp.getFitnessScore()
used?
正如 Joy 在他的评论中所说,单位与您输入的数据相同。
例如,您的输入点云可能来自 obj file。一个点将被存储为 v 9.322 -1.0778 0.44997
。 icp.getFitnessScore()
返回的数字将与点的坐标具有相同的单位。
Does anyone knows what the number I get there means?
您得到的数字代表从源中的每个点到目标中的最近点的均方距离。
也就是说,如果你假设source中的每个点在target[=中都有对应的点50=],对应集来自最近点数据关联,那么这个数字代表所有对应关系之间的均方距离。从下面的源代码可以看出。
为了更好地理解该函数,您可能需要过滤掉它们之间距离较大的对应关系。 (两个点云可能只是部分重叠。)而且该函数实际上有一个可选参数 max_range
来执行此操作。
方法getFitnessScore()
定义于pcl::Registration
,pcl::IterativeClosestPoint
的基class。可选参数max_range
默认为std::numeric_limits<double>::max()
,在definition:
中可以看到
/** \brief Obtain the Euclidean fitness score (e.g., sum of squared distances from the source to the target)
* \param[in] max_range maximum allowable distance between a point and its correspondence in the target
* (default: double::max)
*/
inline double
getFitnessScore (double max_range = std::numeric_limits<double>::max ());
而这个函数的source code是:
template <typename PointSource, typename PointTarget, typename Scalar> inline double
pcl::Registration<PointSource, PointTarget, Scalar>::getFitnessScore (double max_range)
{
double fitness_score = 0.0;
// Transform the input dataset using the final transformation
PointCloudSource input_transformed;
transformPointCloud (*input_, input_transformed, final_transformation_);
std::vector<int> nn_indices (1);
std::vector<float> nn_dists (1);
// For each point in the source dataset
int nr = 0;
for (size_t i = 0; i < input_transformed.points.size (); ++i)
{
// Find its nearest neighbor in the target
tree_->nearestKSearch (input_transformed.points[i], 1, nn_indices, nn_dists);
// Deal with occlusions (incomplete targets)
if (nn_dists[0] <= max_range)
{
// Add to the fitness score
fitness_score += nn_dists[0];
nr++;
}
}
if (nr > 0)
return (fitness_score / nr);
else
return (std::numeric_limits<double>::max ());
}
我使用点云库中的 pcl::IterativeClosestPoint
方法。
截至目前,它的文档似乎处于离线状态。
这里在googlecache. And also a tutorial.
可以调用 icp.getFitnessScore()
来获取到两个云点的均方距离。我只是找不到关于这表明哪种单位的信息。有谁知道我得到的数字是什么意思?例如,我的输出是:0,0003192
。好像有点小,不知道是米,厘米,英尺还是别的什么。
非常感谢。
what kind of unit is
icp.getFitnessScore()
used?
正如 Joy 在他的评论中所说,单位与您输入的数据相同。
例如,您的输入点云可能来自 obj file。一个点将被存储为 v 9.322 -1.0778 0.44997
。 icp.getFitnessScore()
返回的数字将与点的坐标具有相同的单位。
Does anyone knows what the number I get there means?
您得到的数字代表从源中的每个点到目标中的最近点的均方距离。
也就是说,如果你假设source中的每个点在target[=中都有对应的点50=],对应集来自最近点数据关联,那么这个数字代表所有对应关系之间的均方距离。从下面的源代码可以看出。
为了更好地理解该函数,您可能需要过滤掉它们之间距离较大的对应关系。 (两个点云可能只是部分重叠。)而且该函数实际上有一个可选参数 max_range
来执行此操作。
方法getFitnessScore()
定义于pcl::Registration
,pcl::IterativeClosestPoint
的基class。可选参数max_range
默认为std::numeric_limits<double>::max()
,在definition:
/** \brief Obtain the Euclidean fitness score (e.g., sum of squared distances from the source to the target)
* \param[in] max_range maximum allowable distance between a point and its correspondence in the target
* (default: double::max)
*/
inline double
getFitnessScore (double max_range = std::numeric_limits<double>::max ());
而这个函数的source code是:
template <typename PointSource, typename PointTarget, typename Scalar> inline double
pcl::Registration<PointSource, PointTarget, Scalar>::getFitnessScore (double max_range)
{
double fitness_score = 0.0;
// Transform the input dataset using the final transformation
PointCloudSource input_transformed;
transformPointCloud (*input_, input_transformed, final_transformation_);
std::vector<int> nn_indices (1);
std::vector<float> nn_dists (1);
// For each point in the source dataset
int nr = 0;
for (size_t i = 0; i < input_transformed.points.size (); ++i)
{
// Find its nearest neighbor in the target
tree_->nearestKSearch (input_transformed.points[i], 1, nn_indices, nn_dists);
// Deal with occlusions (incomplete targets)
if (nn_dists[0] <= max_range)
{
// Add to the fitness score
fitness_score += nn_dists[0];
nr++;
}
}
if (nr > 0)
return (fitness_score / nr);
else
return (std::numeric_limits<double>::max ());
}