Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 }