Ejemplo n.º 1
0
  void
  AdjacencyRansac::InvalidateQueryIndices(IndexVector &query_indices)
  {
    if (query_indices.empty())
      return;
    // Figure out the points with those query indices
    std::sort(query_indices.begin(), query_indices.end());
    IndexVector::iterator end = std::unique(query_indices.begin(), query_indices.end());
    query_indices.resize(end - query_indices.begin());

    IndexVector indices_to_remove;
    indices_to_remove.reserve(query_indices_.size());
    IndexVector::const_iterator iter = query_indices.begin();
    BOOST_FOREACH(unsigned int index, valid_indices_){
    unsigned int query_index = query_indices_[index];
    if (query_index < *iter)
    continue;
    // If the match has a keypoint in the inliers, remove the match
    while ((iter != end) && (query_index > *iter))
    ++iter;
    if (query_index == *iter)
    {
      indices_to_remove.push_back(index);
      continue;
    }

    if (iter == end)
    break;
  }
Ejemplo n.º 2
0
void
TopologyGraph::dumpBoundary(const IndexVector& boundary, const std::string& filename)
{
    if (boundary.empty())
        return;
    
    osg::Vec3Array* v = new osg::Vec3Array();

    for (IndexVector::const_iterator i = boundary.begin(); i != boundary.end(); ++i)
    {
        const Index& index = *i;
        v->push_back(osg::Vec3(index->x(), index->y(), 0));
    }

    osg::ref_ptr<osg::Geometry> g = new osg::Geometry();
    g->setVertexArray(v);
    g->addPrimitiveSet(new osg::DrawArrays(GL_LINE_LOOP, 0, v->size()));
    g->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, v->size()));
    g->getOrCreateStateSet()->setAttributeAndModes(new osg::Point(3));
    osgDB::writeNodeFile(*(g.get()), filename);
}