void AdjacencyList::node_neighbors(const int& local_index, IndexVector& global_neighbor_indexes) const { BOOST_ASSERT(local_index < p_adjacency.size()); global_neighbor_indexes.clear(); std::copy(p_adjacency[local_index].begin(), p_adjacency[local_index].end(), std::back_inserter(global_neighbor_indexes)); }
/*! * \brief children Populate a children list for the given contour. No control is made. * \param _hierarchy OpenCV contour hierarchy used to find children. * \param _parentIndex Index in _hierarchy of the given contour. _parentIndex must exist in _hierarchy. * \param _children Output list of the found children. * \return number of children. */ void ContourManager::children(const Hierarchy & _hierarchy, int _parentIndex, IndexVector & _children) { _children.clear(); int currentChild = _hierarchy[_parentIndex][HIERARCHY_INDEX_FIRST_CHILD];//First child while (currentChild >= 0) { _children.push_back(currentChild); currentChild = _hierarchy[currentChild][HIERARCHY_INDEX_NEXT]; }//while (currentChild >= 0) }//children