PointCloudLibrary / PointCloudLibrary/pcl
icp setIndices doesn't work
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
I first generate 1000 random points to form the source point cloud:
for (size_t i = 0; i < cloud_in->points.size (); ++i)
{
cloud_in->points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
cloud_in->points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
cloud_in->points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
}
and then form the target point cloud from the front 100 points of source point cloud , and add 0.7 to x
for (size_t i = 0; i < cloud_out->points.size (); ++i)
{
cloud_out->points[i].x = cloud_in->points[i].x + 0.7f;
cloud_out->points[i].y = cloud_in->points[i].y;
cloud_out->points[i].z = cloud_in->points[i].z;
}
I try two times for the indices:
boost::shared_ptr< std::vector > pr(new std::vector);
// first try
// for(int i=0; i<100; i+=1)
// pr->push_back(i);
// second try
for(int i=100; i<200; i+=1)
pr->push_back(i);
but the result transformation is the same, if the setIndices works, the result shouldn't be the same, because the points in source point cloud we use to registration is different.
Your Environment
- Operating System and version: ubuntu16.04
- Compiler:cmake
- PCL Version:1.7
Context
Expected Behavior
Current Behavior
Code to Reproduce
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_out (new pcl::PointCloud<pcl::PointXYZ>);
// Fill in the CloudIn data
cloud_in->width = 1000;
cloud_in->height = 1;
cloud_in->is_dense = false;
cloud_in->points.resize (cloud_in->width * cloud_in->height);
for (size_t i = 0; i < cloud_in->points.size (); ++i)
{
cloud_in->points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
cloud_in->points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
cloud_in->points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
}
cloud_out->width = 100;
cloud_out->height = 1;
cloud_out->is_dense = false;
cloud_out->points.resize (cloud_out->width * cloud_out->height);
for (size_t i = 0; i < cloud_out->points.size (); ++i)
{
cloud_out->points[i].x = cloud_in->points[i].x + 0.7f;
cloud_out->points[i].y = cloud_in->points[i].y;
cloud_out->points[i].z = cloud_in->points[i].z;
}
std::cout << cloud_out->points.size() << std::endl;
boost::shared_ptr< std::vector<int> > pr(new std::vector<int>);
// first try
// for(int i=0; i<100; i+=1)
// pr->push_back(i);
// second try
for(int i=100; i<200; i+=1)
pr->push_back(i);
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp.setMaxCorrespondenceDistance(0.5);
icp.setTransformationEpsilon(1e-12);
icp.setEuclideanFitnessEpsilon(0.0001);
icp.setMaximumIterations (1000000);
icp.setInputSource(cloud_in);
icp.setInputTarget(cloud_out);
//icp.setIndices(pr);
pcl::PointCloud<pcl::PointXYZ> Final;
icp.align(Final);
std::cout << "has converged:" << icp.hasConverged() << " score: " <<
icp.getFitnessScore() << std::endl;
std::cout << icp.getFinalTransformation() << std::endl;
pcl::transformPointCloud(*cloud_out,*cloud_out,icp.getFinalTransformation().inverse());
Possible Solution
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied C++ reproduction with PCL 1.7 and compare results with icp.setIndices(pr) enabled for the two index ranges. Inspect the IterativeClosestPoint setIndices entry point and related index handling. Done means the behavior is explained and, if incorrect, a focused fix or regression test demonstrates that changing source indices affects registration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100