-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
pcl::MinCutSegmentation BUG #5636
Description
When i changed the setting of pcl::MinCutSegmentation and used extract fnction to segment clouds again, the program crashed,I found the extract function call the function recalculateBinaryPotentials, a set edge_marker was created to serve edge flag in the function ,the set was set the size of indices, but the following iteration process visited all the vertex in the graph of cloud, and use the vertex index to visit the set edge_marker , that cause index exceed the range . maybe the size of set edge_marker should set as the size of the cloud ,not the indices
`pcl::MinCutSegmentationV2::recalculateBinaryPotentials ()
{
...
std::vector<std::set > edge_marker;
std::set out_edges_marker;
edge_marker.clear ();
edge_marker.resize (indices_->size() + 2, out_edges_marker);
for (boost::tie (vertex_iter, vertex_end) = boost::vertices (*graph_); vertex_iter != vertex_end; vertex_iter++)
{
VertexDescriptor source_vertex = *vertex_iter;
if (source_vertex == source_ || source_vertex == sink_)
continue;
for (boost::tie (edge_iter, edge_end) = boost::out_edges (source_vertex, *graph_); edge_iter != edge_end; edge_iter++)
{
//If this is not the edge of the graph, but the reverse fictitious edge that is needed for the algorithm then continue
EdgeDescriptor reverse_edge = (*reverse_edges_)[*edge_iter];
if ((*capacity_)[reverse_edge] != 0.0)
continue;
//If we already changed weight for this edge then continue
VertexDescriptor target_vertex = boost::target (*edge_iter, *graph_);
std::set<VertexDescriptor>::iterator iter_out = edge_marker[static_cast<int> (source_vertex)].find (target_vertex);
.....`