Skip to content

Commit

Permalink
fixed segmentation fault
Browse files Browse the repository at this point in the history
Disabled the color field check on downsamplealldata=false
  • Loading branch information
Sérgio Agostinho committed Nov 12, 2015
1 parent 46a351e commit 713fa12
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions filters/src/voxel_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,25 @@ pcl::VoxelGrid<pcl::PCLPointCloud2>::applyFilter (PCLPointCloud2 &output)
Eigen::Vector4f pt = Eigen::Vector4f::Zero ();

int centroid_size = 4;
if (downsample_all_data_)
centroid_size = static_cast<int> (input_->fields.size ());

int rgba_index = -1;

// ---[ RGB special case
// if the data contains "rgba" or "rgb", add an extra field for r/g/b in centroid
for (int d = 0; d < centroid_size; ++d)
if (downsample_all_data_)
{
if (input_->fields[d].name == std::string ("rgba") || input_->fields[d].name == std::string ("rgb"))
centroid_size = static_cast<int> (input_->fields.size ());

// ---[ RGB special case
// if the data contains "rgba" or "rgb", add an extra field for r/g/b in centroid
for (int d = 0; d < centroid_size; ++d)
{
rgba_index = d;
centroid_size += 4;
break;
if (input_->fields[d].name == std::string ("rgba") || input_->fields[d].name == std::string ("rgb"))
{
rgba_index = d;
centroid_size += 4;
break;
}
}
}

// If we don't want to process the entire cloud, but rather filter points far away from the viewpoint first...
if (!filter_field_name_.empty ())
{
Expand Down

0 comments on commit 713fa12

Please sign in to comment.