以下是我遇到的错误:
error: no matching function for call to ‘pcl::ConditionalEuclideanClustering
<pcl::Normal>::setConditionFunction(bool (EuclideanPlaneSegmentation::*)(const pcl::Normal&, const pcl::Normal&, float))’ cec.setConditionFunction(&EuclideanPlaneSegmentation::customRegionGrowing; ^ note: candidate is:/segmentation/conditional_euclidean_clustering.h:125:7:
note: void pcl::ConditionalEuclideanClustering
<PointT>::setConditionFunction(bool (*)(const PointT&, const PointT&, float)) [with PointT = pcl::Normal] setConditionFunction (bool (*condition_function) (const PointT&, const PointT&, float)) ^ note: no known conversion for argument 1 from ‘bool (EuclideanPlaneSegmentation::*)(const
pcl::Normal&, const pcl::Normal&, float)’ to ‘bool (*)(const pcl::Normal&, const pcl::Normal&, float)’
基本上,我有“EuclideanPlaneSegmentation”类,我正在尝试应用这个pcl教程:http://pointclouds.org/documentation/tutorials/conditional_euclidean_clustering.php
在教程中,在主要功能
中cec.setConditionFunction (&customRegionGrowing);
尝试进入该功能:
bool
customRegionGrowing (const PointTypeFull& point_a, const PointTypeFull& point_b, float squared_distance)
{
Eigen::Map<const Eigen::Vector3f> point_a_normal = point_a.normal, point_b_normal = point_b.normal;
if (squared_distance < 10000)
{
if (fabs (point_a.intensity - point_b.intensity) < 8.0f)
return (true);
if (fabs (point_a_normal.dot (point_b_normal)) < 0.06)
return (true);
}
else
{
if (fabs (point_a.intensity - point_b.intensity) < 3.0f)
return (true);
}
return (false);
}
}
我班上的功能相同,我尝试过:
cec.setConditionFunction(&EuclideanPlaneSegmentation::customRegionGrowing);
但它不起作用。我收到了我写的错误。
在我的班上,如果我尝试
cec.setConditionFunction (&customRegionGrowing);
我收到此错误:
/EuclideanPlaneSegmentation.cpp:402:28: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&EuclideanPlaneSegmentation::customRegionGrowing’ [-fpermissive]
cec.setConditionFunction(&customRegionGrowing);
^
/EuclideanPlaneSegmentation.cpp:402:65: error: no matching function for call to ‘pcl::ConditionalEuclideanClustering<pcl::Normal>::setConditionFunction(bool (EuclideanPlaneSegmentation::*)(const pcl::Normal&, const pcl::Normal&, float))’
cec.setConditionFunction(&customRegionGrowing);
有谁知道如何解决这个问题有什么问题?
答案 0 :(得分:2)
方法setConditionFunction
需要一个函数,但是你传递的是一个成员(非静态)方法。声明传递的方法static
应该可以解决问题。
答案 1 :(得分:1)
传递静态方法有效。但是如果您想在您的条件中动态重新配置参数,您可以使用
setConditionFunction(boost::bind(®ularization, this, _1, _2, _3))