00001 // 00002 // agast9 - OAST, an optimal corner detector based on the 00003 // accelerated segment test for a 16 pixel mask 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 OAST9_16_H 00021 #define OAST9_16_H 00022 00023 #include <stdint.h> 00024 #include "AstDetector.h" 00025 00026 struct CvPoint; 00027 00028 namespace agast{ 00029 00030 class OastDetector9_16 : public AstDetector 00031 { 00032 public: 00033 OastDetector9_16():AstDetector(){;} 00034 OastDetector9_16(int width, int height, int thr):AstDetector(width, height, thr){init_pattern();}; 00035 ~OastDetector9_16(){} 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=3; 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 int_fast16_t s_offset12; 00058 int_fast16_t s_offset13; 00059 int_fast16_t s_offset14; 00060 int_fast16_t s_offset15; 00061 00062 void init_pattern() 00063 { 00064 s_offset0=(-3)+(0)*xsize; 00065 s_offset1=(-3)+(-1)*xsize; 00066 s_offset2=(-2)+(-2)*xsize; 00067 s_offset3=(-1)+(-3)*xsize; 00068 s_offset4=(0)+(-3)*xsize; 00069 s_offset5=(1)+(-3)*xsize; 00070 s_offset6=(2)+(-2)*xsize; 00071 s_offset7=(3)+(-1)*xsize; 00072 s_offset8=(3)+(0)*xsize; 00073 s_offset9=(3)+(1)*xsize; 00074 s_offset10=(2)+(2)*xsize; 00075 s_offset11=(1)+(3)*xsize; 00076 s_offset12=(0)+(3)*xsize; 00077 s_offset13=(-1)+(3)*xsize; 00078 s_offset14=(-2)+(2)*xsize; 00079 s_offset15=(-3)+(1)*xsize; 00080 } 00081 }; 00082 00083 } 00084 00085 #endif /* OAST9_16_H */