./fast_N_features [--NUM N] | ./learn_fast_tree
Definition in file fast_N_features.cc.
#include <iostream>
#include <gvars3/instances.h>
Go to the source code of this file.
Functions | |
bool | is_corner (const char *str, int num_for_corner, char type) |
int | main (int argc, char **argv) |
bool is_corner | ( | const char * | str, | |
int | num_for_corner, | |||
char | type | |||
) | [inline] |
Determine if a string has the properties of a FAST-N corner.
In other words, if it has enough consecutive characters of the correct type. This function assumes that the string wraps in a circular manner.
str | String to test for cornerness. | |
num_for_corner | Number of consecutive characters required for corner | |
type | Character value which must appear consecutively# |
Definition at line 52 of file fast_N_features.cc.
Referenced by tree_element::detect_corner_oriented(), load_a_tree(), main(), and tree_element::print().
00053 { 00054 int num_consecutive=0; 00055 int first_cons=0; 00056 00057 for(int i=0; i<16; i++) 00058 { 00059 if(str[i] == type) 00060 { 00061 num_consecutive++; 00062 00063 if(num_consecutive == num_for_corner) 00064 return 1; 00065 } 00066 else 00067 { 00068 if(num_consecutive == i) 00069 first_cons=i; 00070 00071 num_consecutive=0; 00072 } 00073 } 00074 00075 if(first_cons+num_consecutive >=num_for_corner) 00076 return 1; 00077 else 00078 return 0; 00079 }
int main | ( | int | argc, | |
char ** | argv | |||
) |
This is the main function for this program.
It generates all possible FAST pixel rings using brute-force and outputs them along with their class and a uniform weighting over all features.
argc | Number of commandline arguments | |
argv | List of commandline arguments |
Definition at line 86 of file fast_N_features.cc.
References is_corner().
00087 { 00088 GUI.parseArguments(argc, argv); 00089 00090 char types[]="bsd."; 00091 char F[17]="................"; 00092 00093 int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p; 00094 cout << 16 << endl; 00095 cout << "[0 3] [1 3] [2 2] [3 1] [3 0] [3 -1] [2 -2] [1 -3] [0 -3] [-1 -3] [-2 -2] [-3 -1] [-3 0] [-3 1] [-2 2] [-1 3]" << endl; 00096 00097 int N = GV3::get<int>("N", 9, 1); 00098 00099 for(a = 0, F[ 0]='b'; a < 3; a++, F[ 0]=types[a]) 00100 for(b = 0, F[ 1]='b'; b < 3; b++, F[ 1]=types[b]) 00101 for(c = 0, F[ 2]='b'; c < 3; c++, F[ 2]=types[c]) 00102 for(d = 0, F[ 3]='b'; d < 3; d++, F[ 3]=types[d]) 00103 for(e = 0, F[ 4]='b'; e < 3; e++, F[ 4]=types[e]) 00104 for(f = 0, F[ 5]='b'; f < 3; f++, F[ 5]=types[f]) 00105 for(g = 0, F[ 6]='b'; g < 3; g++, F[ 6]=types[g]) 00106 for(h = 0, F[ 7]='b'; h < 3; h++, F[ 7]=types[h]) 00107 for(i = 0, F[ 8]='b'; i < 3; i++, F[ 8]=types[i]) 00108 for(j = 0, F[ 9]='b'; j < 3; j++, F[ 9]=types[j]) 00109 for(k = 0, F[10]='b'; k < 3; k++, F[10]=types[k]) 00110 for(l = 0, F[11]='b'; l < 3; l++, F[11]=types[l]) 00111 for(m = 0, F[12]='b'; m < 3; m++, F[12]=types[m]) 00112 for(n = 0, F[13]='b'; n < 3; n++, F[13]=types[n]) 00113 for(o = 0, F[14]='b'; o < 3; o++, F[14]=types[o]) 00114 for(p = 0, F[15]='b'; p < 3; p++, F[15]=types[p]) 00115 cout << F << " 1 " << (is_corner(F, N, 'b') || is_corner(F, N, 'd')) << endl; 00116 }