agast5_8_nms.cc
Go to the documentation of this file.
00001 //
00002 //    agast5 - AGAST, an adaptive and generic corner detector based on the
00003 //              accelerated segment test for a 8 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 #include <stdint.h>
00021 #include <stdlib.h>
00022 #include "cvWrapper.h"
00023 #include "agast5_8.h"
00024 
00025 using namespace std;
00026 using namespace agast;
00027 
00028 //using also bisection as propsed by Edward Rosten in FAST,
00029 //but it is based on the OAST
00030 int AgastDetector5_8::cornerScore(const unsigned char* p, bool ignorePattern)
00031 {
00032     int bmin = b;
00033     int bmax = 255;
00034     int b_test = (bmax + bmin)/2;
00035 
00036     register int_fast16_t offset0=s_offset0;
00037         register int_fast16_t offset1=s_offset1;
00038         register int_fast16_t offset2=s_offset2;
00039         register int_fast16_t offset3=s_offset3;
00040         register int_fast16_t offset4=s_offset4;
00041         register int_fast16_t offset5=s_offset5;
00042         register int_fast16_t offset6=s_offset6;
00043         register int_fast16_t offset7=s_offset7;
00044 
00045         while(1)
00046         {
00047                 register const int cb = *p + b_test;
00048                 register const int c_b = *p - b_test;
00049                 if(p[offset0] > cb)
00050                   if(p[offset2] > cb)
00051                     if(p[offset3] > cb)
00052                       if(p[offset5] > cb)
00053                         if(p[offset1] > cb)
00054                           if(p[offset4] > cb)
00055                             goto is_a_corner;
00056                           else
00057                             if(p[offset7] > cb)
00058                               goto is_a_corner;
00059                             else
00060                               goto is_not_a_corner;
00061                         else
00062                           if(p[offset4] > cb)
00063                             if(p[offset6] > cb)
00064                               goto is_a_corner;
00065                             else
00066                               goto is_not_a_corner;
00067                           else
00068                             goto is_not_a_corner;
00069                       else
00070                         if(p[offset1] > cb)
00071                           if(p[offset4] > cb)
00072                             goto is_a_corner;
00073                           else
00074                             if(p[offset7] > cb)
00075                               goto is_a_corner;
00076                             else
00077                               goto is_not_a_corner;
00078                         else
00079                           goto is_not_a_corner;
00080                     else
00081                       if(p[offset7] > cb)
00082                         if(p[offset6] > cb)
00083                           if(p[offset5] > cb)
00084                             if(p[offset1] > cb)
00085                               goto is_a_corner;
00086                             else
00087                               if(p[offset4] > cb)
00088                                 goto is_a_corner;
00089                               else
00090                                 goto is_not_a_corner;
00091                           else
00092                             if(p[offset1] > cb)
00093                               goto is_a_corner;
00094                             else
00095                               goto is_not_a_corner;
00096                         else
00097                           goto is_not_a_corner;
00098                       else
00099                         if(p[offset5] < c_b)
00100                           if(p[offset3] < c_b)
00101                             if(p[offset7] < c_b)
00102                               if(p[offset4] < c_b)
00103                                 if(p[offset6] < c_b)
00104                                   goto is_a_corner;
00105                                 else
00106                                   goto is_not_a_corner;
00107                               else
00108                                 goto is_not_a_corner;
00109                             else
00110                               goto is_not_a_corner;
00111                           else
00112                             goto is_not_a_corner;
00113                         else
00114                           goto is_not_a_corner;
00115                   else
00116                     if(p[offset5] > cb)
00117                       if(p[offset7] > cb)
00118                         if(p[offset6] > cb)
00119                           if(p[offset1] > cb)
00120                             goto is_a_corner;
00121                           else
00122                             if(p[offset4] > cb)
00123                               goto is_a_corner;
00124                             else
00125                               goto is_not_a_corner;
00126                         else
00127                           goto is_not_a_corner;
00128                       else
00129                         goto is_not_a_corner;
00130                     else
00131                       if(p[offset5] < c_b)
00132                         if(p[offset3] < c_b)
00133                           if(p[offset2] < c_b)
00134                             if(p[offset1] < c_b)
00135                               if(p[offset4] < c_b)
00136                                 goto is_a_corner;
00137                               else
00138                                 goto is_not_a_corner;
00139                             else
00140                               if(p[offset4] < c_b)
00141                                 if(p[offset6] < c_b)
00142                                   goto is_a_corner;
00143                                 else
00144                                   goto is_not_a_corner;
00145                               else
00146                                 goto is_not_a_corner;
00147                           else
00148                             if(p[offset7] < c_b)
00149                               if(p[offset4] < c_b)
00150                                 if(p[offset6] < c_b)
00151                                   goto is_a_corner;
00152                                 else
00153                                   goto is_not_a_corner;
00154                               else
00155                                 goto is_not_a_corner;
00156                             else
00157                               goto is_not_a_corner;
00158                         else
00159                           goto is_not_a_corner;
00160                       else
00161                         goto is_not_a_corner;
00162                 else if(p[offset0] < c_b)
00163                   if(p[offset2] < c_b)
00164                     if(p[offset7] > cb)
00165                       if(p[offset3] < c_b)
00166                         if(p[offset5] < c_b)
00167                           if(p[offset1] < c_b)
00168                             if(p[offset4] < c_b)
00169                               goto is_a_corner;
00170                             else
00171                               goto is_not_a_corner;
00172                           else
00173                             if(p[offset4] < c_b)
00174                               if(p[offset6] < c_b)
00175                                 goto is_a_corner;
00176                               else
00177                                 goto is_not_a_corner;
00178                             else
00179                               goto is_not_a_corner;
00180                         else
00181                           if(p[offset1] < c_b)
00182                             if(p[offset4] < c_b)
00183                               goto is_a_corner;
00184                             else
00185                               goto is_not_a_corner;
00186                           else
00187                             goto is_not_a_corner;
00188                       else
00189                         if(p[offset5] > cb)
00190                           if(p[offset3] > cb)
00191                             if(p[offset4] > cb)
00192                               if(p[offset6] > cb)
00193                                 goto is_a_corner;
00194                               else
00195                                 goto is_not_a_corner;
00196                             else
00197                               goto is_not_a_corner;
00198                           else
00199                             goto is_not_a_corner;
00200                         else
00201                           goto is_not_a_corner;
00202                     else
00203                       if(p[offset7] < c_b)
00204                         if(p[offset3] < c_b)
00205                           if(p[offset5] < c_b)
00206                             if(p[offset1] < c_b)
00207                               goto is_a_corner;
00208                             else
00209                               if(p[offset4] < c_b)
00210                                 if(p[offset6] < c_b)
00211                                   goto is_a_corner;
00212                                 else
00213                                   goto is_not_a_corner;
00214                               else
00215                                 goto is_not_a_corner;
00216                           else
00217                             if(p[offset1] < c_b)
00218                               goto is_a_corner;
00219                             else
00220                               goto is_not_a_corner;
00221                         else
00222                           if(p[offset6] < c_b)
00223                             if(p[offset5] < c_b)
00224                               if(p[offset1] < c_b)
00225                                 goto is_a_corner;
00226                               else
00227                                 if(p[offset4] < c_b)
00228                                   goto is_a_corner;
00229                                 else
00230                                   goto is_not_a_corner;
00231                             else
00232                               if(p[offset1] < c_b)
00233                                 goto is_a_corner;
00234                               else
00235                                 goto is_not_a_corner;
00236                           else
00237                             goto is_not_a_corner;
00238                       else
00239                         if(p[offset3] < c_b)
00240                           if(p[offset5] < c_b)
00241                             if(p[offset1] < c_b)
00242                               if(p[offset4] < c_b)
00243                                 goto is_a_corner;
00244                               else
00245                                 goto is_not_a_corner;
00246                             else
00247                               if(p[offset4] < c_b)
00248                                 if(p[offset6] < c_b)
00249                                   goto is_a_corner;
00250                                 else
00251                                   goto is_not_a_corner;
00252                               else
00253                                 goto is_not_a_corner;
00254                           else
00255                             if(p[offset1] < c_b)
00256                               if(p[offset4] < c_b)
00257                                 goto is_a_corner;
00258                               else
00259                                 goto is_not_a_corner;
00260                             else
00261                               goto is_not_a_corner;
00262                         else
00263                           goto is_not_a_corner;
00264                   else
00265                     if(p[offset5] > cb)
00266                       if(p[offset3] > cb)
00267                         if(p[offset2] > cb)
00268                           if(p[offset1] > cb)
00269                             if(p[offset4] > cb)
00270                               goto is_a_corner;
00271                             else
00272                               goto is_not_a_corner;
00273                           else
00274                             if(p[offset4] > cb)
00275                               if(p[offset6] > cb)
00276                                 goto is_a_corner;
00277                               else
00278                                 goto is_not_a_corner;
00279                             else
00280                               goto is_not_a_corner;
00281                         else
00282                           if(p[offset7] > cb)
00283                             if(p[offset4] > cb)
00284                               if(p[offset6] > cb)
00285                                 goto is_a_corner;
00286                               else
00287                                 goto is_not_a_corner;
00288                             else
00289                               goto is_not_a_corner;
00290                           else
00291                             goto is_not_a_corner;
00292                       else
00293                         goto is_not_a_corner;
00294                     else
00295                       if(p[offset5] < c_b)
00296                         if(p[offset7] < c_b)
00297                           if(p[offset6] < c_b)
00298                             if(p[offset1] < c_b)
00299                               goto is_a_corner;
00300                             else
00301                               if(p[offset4] < c_b)
00302                                 goto is_a_corner;
00303                               else
00304                                 goto is_not_a_corner;
00305                           else
00306                             goto is_not_a_corner;
00307                         else
00308                           goto is_not_a_corner;
00309                       else
00310                         goto is_not_a_corner;
00311                 else
00312                   if(p[offset3] > cb)
00313                     if(p[offset5] > cb)
00314                       if(p[offset2] > cb)
00315                         if(p[offset1] > cb)
00316                           if(p[offset4] > cb)
00317                             goto is_a_corner;
00318                           else
00319                             goto is_not_a_corner;
00320                         else
00321                           if(p[offset4] > cb)
00322                             if(p[offset6] > cb)
00323                               goto is_a_corner;
00324                             else
00325                               goto is_not_a_corner;
00326                           else
00327                             goto is_not_a_corner;
00328                       else
00329                         if(p[offset7] > cb)
00330                           if(p[offset4] > cb)
00331                             if(p[offset6] > cb)
00332                               goto is_a_corner;
00333                             else
00334                               goto is_not_a_corner;
00335                           else
00336                             goto is_not_a_corner;
00337                         else
00338                           goto is_not_a_corner;
00339                     else
00340                       goto is_not_a_corner;
00341                   else
00342                     if(p[offset3] < c_b)
00343                       if(p[offset5] < c_b)
00344                         if(p[offset2] < c_b)
00345                           if(p[offset1] < c_b)
00346                             if(p[offset4] < c_b)
00347                               goto is_a_corner;
00348                             else
00349                               goto is_not_a_corner;
00350                           else
00351                             if(p[offset4] < c_b)
00352                               if(p[offset6] < c_b)
00353                                 goto is_a_corner;
00354                               else
00355                                 goto is_not_a_corner;
00356                             else
00357                               goto is_not_a_corner;
00358                         else
00359                           if(p[offset7] < c_b)
00360                             if(p[offset4] < c_b)
00361                               if(p[offset6] < c_b)
00362                                 goto is_a_corner;
00363                               else
00364                                 goto is_not_a_corner;
00365                             else
00366                               goto is_not_a_corner;
00367                           else
00368                             goto is_not_a_corner;
00369                       else
00370                         goto is_not_a_corner;
00371                     else
00372                       goto is_not_a_corner;
00373 
00374                 is_a_corner:
00375                         bmin=b_test;
00376                         goto end;
00377 
00378                 is_not_a_corner:
00379                         bmax=b_test;
00380                         goto end;
00381 
00382                 end:
00383 
00384                 if(bmin == bmax - 1 || bmin == bmax)
00385                         return bmin;
00386                 b_test = (bmin + bmax) / 2;
00387         }
00388 }
00389 
00390 


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