I had a similar problem. It turned out in my case that the two point clouds were further apart than the max correspondence distance. This resulted in no correspondences being found, which resulted in a segfault when the ransac algorithm tried to choose samples to do the model alignment.
Hi All,
I can't for the life of me, figure what is going wrong. Perhaps, I do not
know the structure of PointCloud very well yet but I keep getting a segfault
at the last line in "reg.align". I would like to fill in the point cloud
with a buffer of floats/doubles and then run ICP on the two cloud points. Is
this the right way to do it? It seems to work if I use PCD files but not
when I manually input data like below. Hope someone can help.
// Fill in the model cloud data
model.width = modelN;
model.height = 1;
model.is_dense = false;
model.points.resize (model.width * model.height);
for (size_t i = 0; i < model.points.size (); i++)
{
model.points[i].x = (float)modelPointsT[3*i + 0];
model.points[i].y = (float)modelPointsT[3*i + 1];
model.points[i].z = (float)modelPointsT[3*i + 2];
}
// Fill in the model cloud data
data.width = dataN;
data.height = 1;
data.is_dense = false;
data.points.resize (data.width * data.height);
for (size_t i = 0; i < data.points.size (); i++)
{
data.points[i].x = (float)dataPointsT[3*i + 0] + 5;
data.points[i].y = (float)dataPointsT[3*i + 1];
data.points[i].z = (float)dataPointsT[3*i + 2];
}
pcl::PointCloud<pcl::PointXYZ> output;
pcl::IterativeClosestPointNonLinear<pcl::PointXYZ, pcl::PointXYZ> reg;
reg.setMaxCorrespondenceDistance (0.1);
reg.setTransformationEpsilon (1e-6);
reg.setMaximumIterations (50);
reg.setInputCloud(boost::make_shared<const
pcl::PointCloud<pcl::PointXYZ> > (data));
reg.setInputTarget(boost::make_shared<const
pcl::PointCloud<pcl::PointXYZ> > (model));
Eigen3::Matrix4f transform;
//reg.computeTransformation(output);
//reg.estimateRigidTransformationLM(data,model,transform);
printf("Done\n");
reg.align(output);
--
View this message in context: http://ros-users.122217.n3.nabble.com/ICP-PCL-with-foreign-data-tp2066643p2066643.html
Sent from the ROS-Users mailing list archive at Nabble.com.
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users