Skip to content

Commit

Permalink
Merge pull request #617 from nizar-sallem/fix_region_growing
Browse files Browse the repository at this point in the history
Fix: make sure point is finite before vicinity search
  • Loading branch information
taketwo committed Apr 7, 2014
2 parents e44e063 + 346e44c commit 1b58c8b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions segmentation/include/pcl/segmentation/impl/region_growing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,27 @@ pcl::RegionGrowing<PointT, NormalT>::findPointNeighbours ()
std::vector<float> distances;

point_neighbours_.resize (input_->points.size (), neighbours);

for (int i_point = 0; i_point < point_number; i_point++)
if (input_->is_dense)
{
int point_index = (*indices_)[i_point];
neighbours.clear ();
search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances);
point_neighbours_[point_index].swap (neighbours);
for (int i_point = 0; i_point < point_number; i_point++)
{
int point_index = (*indices_)[i_point];
neighbours.clear ();
search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances);
point_neighbours_[point_index].swap (neighbours);
}
}
else
{
for (int i_point = 0; i_point < point_number; i_point++)
{
neighbours.clear ();
int point_index = (*indices_)[i_point];
if (!pcl::isFinite (input_->points[point_index]))
continue;
search_->nearestKSearch (i_point, neighbour_number_, neighbours, distances);
point_neighbours_[point_index].swap (neighbours);
}
}
}

Expand Down

0 comments on commit 1b58c8b

Please sign in to comment.