00001 // 00002 // agast7s - AGAST, an adaptive and generic corner detector based on the 00003 // accelerated segment test for a 12 pixel mask in square format 00004 // 00005 // Copyright (C) 2010 Elmar Mair 00006 // 00007 // This program is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 00020 #ifndef AGAST7_12S_H 00021 #define AGAST7_12S_H 00022 00023 #include <stdint.h> 00024 #include "AstDetector.h" 00025 00026 struct CvPoint; 00027 00028 namespace agast{ 00029 00030 class AgastDetector7_12s : public AstDetector 00031 { 00032 public: 00033 AgastDetector7_12s():AstDetector(){;} 00034 AgastDetector7_12s(int width, int height, int thr):AstDetector(width, height, thr){init_pattern();}; 00035 ~AgastDetector7_12s(){} 00036 void detect(const unsigned char* im, 00037 std::vector<CvPoint>& keypoints); 00038 void nms(const unsigned char* im, 00039 const std::vector<CvPoint>& keypoints, std::vector<CvPoint>& keypoints_nms); 00040 int get_borderWidth(){return borderWidth;} 00041 int cornerScore(const unsigned char* p, bool ignorePattern=false); 00042 00043 private: 00044 static const int borderWidth=2; 00045 int_fast16_t s_offset0; 00046 int_fast16_t s_offset1; 00047 int_fast16_t s_offset2; 00048 int_fast16_t s_offset3; 00049 int_fast16_t s_offset4; 00050 int_fast16_t s_offset5; 00051 int_fast16_t s_offset6; 00052 int_fast16_t s_offset7; 00053 int_fast16_t s_offset8; 00054 int_fast16_t s_offset9; 00055 int_fast16_t s_offset10; 00056 int_fast16_t s_offset11; 00057 00058 void init_pattern() 00059 { 00060 s_offset0=(-2)+(0)*xsize; 00061 s_offset1=(-2)+(-1)*xsize; 00062 s_offset2=(-1)+(-2)*xsize; 00063 s_offset3=(0)+(-2)*xsize; 00064 s_offset4=(1)+(-2)*xsize; 00065 s_offset5=(2)+(-1)*xsize; 00066 s_offset6=(2)+(0)*xsize; 00067 s_offset7=(2)+(1)*xsize; 00068 s_offset8=(1)+(2)*xsize; 00069 s_offset9=(0)+(2)*xsize; 00070 s_offset10=(-1)+(2)*xsize; 00071 s_offset11=(-2)+(1)*xsize; 00072 } 00073 }; 00074 00075 } 00076 00077 #endif /* AGAST7_12S_H */