Esempio n. 1
0
void drawPolyline(pointList list)
{
    if(list.size() < 2)
        return;

    glBegin(GL_LINE_STRIP);
    {
        pointList::const_iterator endIt = list.end();
        for(pointList::const_iterator it = list.begin(); it != endIt; ++it) {
            glVertex2d(it->first, it->second);
        }
    }
    glEnd();
}
  /*
   * find corners with maximal cornerness
   */
  bool harrisCorners::findCornerMaxima(const channel& cornerness,
                                             channel& cornersOnly,
                                             pointList& cornerMax) const {
    if (cornerness.empty()) {
      cornersOnly.clear();
      cornerMax.clear();
      return true;
    }

    const parameters& par = getParameters();

    const float corner = par.cornerValue/255.0f;
    const float noCorner = par.noCornerValue/255.0f;

    localMaxima<float> lmax;
    localMaxima<float>::parameters lmaxPar(par.localMaximaParameters);
    lmaxPar.noMaxValue = noCorner;
    lmaxPar.maxNumber = par.maximumCorners;
    lmax.setParameters(lmaxPar);

    if (lmax.apply(cornerness,cornersOnly,cornerMax)) {
      pointList::iterator it;
      int i;
      for (it=cornerMax.begin(),i=0;
           (it!=cornerMax.end());
           ++it) {
        cornersOnly.at(*it) = corner;
      }

      for (;it!=cornerMax.end();++it) {
        cornersOnly.at(*it) = noCorner;
      }

      return true;
    }
    return false;
  }