Ask Your Question
0

Boundary Estimation Error.

asked 2013-05-02 00:40:14 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am trying to extract boundary points from point cloud,and want to print the boundary points.Unfortunately, I got error like error C2248: 'pcl::BoundaryEstimation<pointint,pointnt,pointoutt>::computeFeature' : cannot access protected member declared in class 'pcl::BoundaryEstimation<pointint,pointnt,pointoutt>'. Did anybody experience this? Thanx in advance.

Here is my sample code.

int main (..) 
{ 
//Load point cloud 

pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>); 
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; 
ne.setInputCloud (cloud.makeShared()); 
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ()); 
ne.setSearchMethod (tree); 
ne.setRadiusSearch (0.03); 
ne.compute (*normals); 

pcl::PointCloud<pcl::Boundary> boundaries; 
pcl::BoundaryEstimation<pcl::PointXYZ, pcl::Normal, pcl::Boundary> est; 
est.setInputCloud (cloud.makeShared()); 
est.setInputNormals (normals); 
est.setRadiusSearch (0.03); 
est.setSearchMethod (pcl::search::KdTree<pcl::PointXYZ>::Ptr (new pcl::search::KdTree<pcl::PointXYZ>)); 
est.compute (boundaries); 

pcl::PointCloud<pcl::Boundary>::Ptr boundary_cloud (new pcl::PointCloud<pcl::Boundary> ()); 
est.computeFeature(*boundary_cloud); /// Error Here 

cout<<"Boundary Size:"<<boundaries.points.size()<<endl; 
}
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-05-02 02:51:55 -0500

updated 2013-05-03 03:03:52 -0500

As shown here, the computeFeature call is a protected member of the BoundaryEstimation class, so you are not able to call this method from your code. You can see in the source for compute that computeFeature is called by the publicly-accessible compute method. So, it should be sufficient to just call compute.

Try just removing these lines:

pcl::PointCloud<pcl::Boundary>::Ptr boundary_cloud (new pcl::PointCloud<pcl::Boundary> ()); 
est.computeFeature(*boundary_cloud); /// Error Here

Edit:
I believe that pcl::BoundaryEstimation only returns a boolean flag for whether or not a given point is on the boundary. You'll need to access the original point cloud to get the XYZ coordinates of matching points:

for (int i=0; i<cloud.size(); i++)
  if (boundaries.points[i].boundary_point == 1)
    cout << cloud.points[i];

If you are seeing garbage values when printing out boundary_point values, it may be because BoundaryEstimation can't find the nearest-neighbors in your point cloud. In this case, it sets boundary_point to NaN (which may look like "garbage" when printed.

edit flag offensive delete link more

Comments

Thank you. But how can I access boundary point`s x, y and z coordinate information? I use following line but it gave garbage value. for (size_t i = 0; i < boundaries.points.size (); ++i) std::cerr << " " << boundaries.points[i].boundary_point<<endl;

Nihad gravatar image Nihad  ( 2013-05-02 19:16:51 -0500 )edit
0

answered 2013-05-02 19:19:25 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Thank you@Zoss. But how can I access boundary point`s x, y and z coordinate information? I use following line but it gave garbage value.

for (size_t i = 0; i < boundaries.points.size (); ++i) std::cerr << " " << boundaries.points[i].boundary_point<<endl;
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-02 00:40:14 -0500

Seen: 988 times

Last updated: May 03 '13