AstDetector.cc
Go to the documentation of this file.
00001 //
00002 //    AstDetector - the interface class for the AGAST corner detector
00003 //
00004 //    Copyright (C) 2010  Elmar Mair
00005 //
00006 //    This program is free software: you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation, either version 3 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    This program is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 #include "AstDetector.h"
00020 #include "cvWrapper.h"
00021 
00022 using namespace std;
00023 using namespace agast;
00024 
00025 void AstDetector::score(const unsigned char* i, const std::vector<CvPoint>& corners_all)
00026 {
00027         unsigned int n=0;
00028     unsigned int num_corners=corners_all.size();
00029 
00030         if(num_corners > scores.capacity())
00031         {
00032                 if(scores.capacity()==0)
00033                 {
00034                         scores.reserve(512 > num_corners ? 512 : num_corners);
00035                 }
00036                 else
00037                 {
00038                         unsigned int nScores = scores.capacity()*2;
00039                         if(num_corners > nScores)
00040                                 nScores = num_corners;
00041                         scores.reserve(nScores);
00042                 }
00043         }
00044 
00045     scores.resize(num_corners);
00046 
00047     for(; n < num_corners; n++)
00048         scores[n] = cornerScore(i + corners_all[n].y*xsize + corners_all[n].x);
00049 }
00050 
00051 void AstDetector::nms(const unsigned char* im, const std::vector<CvPoint>& corners_all,
00052                 std::vector<CvPoint>& corners_nms)
00053 {
00054         score(im,corners_all);
00055         nonMaximumSuppression(corners_all, corners_nms);
00056 }


ptam
Author(s): Stephan Weiss, Markus Achtelik, Simon Lynen
autogenerated on Tue Jan 7 2014 11:12:22