Defines | |
#define | fatal(E, S,...) vfatal((E), (S), (tag::Fmt,## __VA_ARGS__)) |
Functions | |
vector< string > | split (const string &s) |
template<class C> | |
C | ato (const string &s) |
double | sq (double d) |
vector< int > | range (int num) |
template<class C> | |
void | vfatal (int err, const string &s, const C &list) |
istream & | operator>> (istream &i, array< float, 2 > &f) |
array< float, 2 > | Arr (const Vector< 2 > &vec) |
Matrix< 3 > | invert (const Matrix< 3 > &m) |
void | draw_offset_list (const vector< ImageRef > &offsets) |
void | draw_offsets () |
CVD::ImageRef | ir_rounded (const tag::array< float, 2 > &v) |
#define fatal | ( | E, | |||
S, | |||||
... | ) | vfatal((E), (S), (tag::Fmt,## __VA_ARGS__)) |
Print an error message and the exit.
E | Error code | |
S | Format string |
Definition at line 125 of file learn_fast_tree.cc.
Referenced by find_best_split(), load_features(), main(), and datapoint< FEATURE_SIZE >::pack_trits().
vector<string> split | ( | const string & | s | ) |
Tokenise a string.
s | String to be split |
Definition at line 249 of file faster_tree.cc.
Referenced by load_a_tree().
00250 { 00251 istringstream i(s); 00252 00253 vector<string> v; 00254 00255 while(!i.eof()) 00256 { 00257 string s; 00258 i >> s; 00259 if(s != "") 00260 v.push_back(s); 00261 } 00262 return v; 00263 }
C ato | ( | const string & | s | ) | [inline] |
String to some class.
Name modelled on atoi.
s | String to parse |
Definition at line 269 of file faster_tree.cc.
00270 { 00271 istringstream i(s); 00272 C c; 00273 i >> c; 00274 00275 if(i.bad()) 00276 throw ParseError(); 00277 00278 return c; 00279 }
double sq | ( | double | d | ) |
Square a number.
d | Number to square |
Definition at line 100 of file learn_detector.cc.
Referenced by learn_detector().
vector<int> range | ( | int | num | ) |
Populate a std::vector with the numbers 0,1,.
..,num
num | Size if the range |
Definition at line 110 of file learn_detector.cc.
00111 { 00112 vector<int> r; 00113 00114 for(int i=0; i < num; i++) 00115 r.push_back(i); 00116 return r; 00117 }
void vfatal | ( | int | err, | |
const string & | s, | |||
const C & | list | |||
) | [inline] |
Print an error message and the exit, using Tuple stype VARARGS.
err | Error code | |
s | Format string | |
list | Argument list |
Definition at line 131 of file learn_fast_tree.cc.
istream& operator>> | ( | istream & | i, | |
array< float, 2 > & | f | |||
) |
Load an array from an istream.
i | Stream to load from | |
f | array to load in to |
Definition at line 88 of file load_data.cc.
array<float, 2> Arr | ( | const Vector< 2 > & | vec | ) |
Convert a vector in to an array.
vec | Vector to convert |
Definition at line 97 of file load_data.cc.
Referenced by load_warps_vgg().
Matrix<3> invert | ( | const Matrix< 3 > & | m | ) |
Invert a matrix.
m | Matrix to invert |
Definition at line 223 of file load_data.cc.
Referenced by tree_element::detect_corner(), load_warps_vgg(), and tree_element::make_fast_detector().
void draw_offset_list | ( | const vector< ImageRef > & | offsets | ) |
Pretty print some offsets to stdout.
offsets | List of offsets to pretty-print. |
Definition at line 91 of file offsets.cc.
Referenced by draw_offsets().
00092 { 00093 00094 cout << "Allowed offsets: " << offsets.size() << endl; 00095 00096 ImageRef min, max; 00097 min.x = *min_element(member_iterator(offsets.begin(), &ImageRef::x), member_iterator(offsets.end(), &ImageRef::x)); 00098 max.x = *max_element(member_iterator(offsets.begin(), &ImageRef::x), member_iterator(offsets.end(), &ImageRef::x)); 00099 min.y = *min_element(member_iterator(offsets.begin(), &ImageRef::y), member_iterator(offsets.end(), &ImageRef::y)); 00100 max.y = *max_element(member_iterator(offsets.begin(), &ImageRef::y), member_iterator(offsets.end(), &ImageRef::y)); 00101 00102 cout << print << min <<max << endl; 00103 00104 Image<int> o(max-min+ImageRef(1,1), -1); 00105 for(unsigned int i=0; i <offsets.size(); i++) 00106 o[offsets[i] -min] = i; 00107 00108 for(int y=0; y < o.size().y; y++) 00109 { 00110 for(int x=0; x < o.size().x; x++) 00111 cout << "+------"; 00112 cout << "+"<< endl; 00113 00114 for(int x=0; x < o.size().x; x++) 00115 cout << "| "; 00116 cout << "|"<< endl; 00117 00118 00119 for(int x=0; x < o.size().x; x++) 00120 { 00121 if(o[y][x] >= 0) 00122 cout << "| " << setw(2) << o[y][x] << " "; 00123 else if(ImageRef(x, y) == o.size() / 2) 00124 cout << "| " << "#" << " "; 00125 else 00126 cout << "| "; 00127 } 00128 cout << "|" << endl; 00129 00130 for(int x=0; x < o.size().x; x++) 00131 cout << "| "; 00132 cout << "|"<< endl; 00133 } 00134 00135 for(int x=0; x < o.size().x; x++) 00136 cout << "+------"; 00137 cout << "+"<< endl; 00138 00139 cout << endl; 00140 00141 }
void draw_offsets | ( | ) |
Prettyprints the contents of offsets.
Definition at line 201 of file offsets.cc.
Referenced by run_learn_detector().
00202 { 00203 //Print the offsets out. 00204 for(unsigned int i=0; i < 8; i++) 00205 { 00206 cout << "Offsets " << i << endl; 00207 draw_offset_list(offsets[i]); 00208 cout << endl; 00209 } 00210 }
CVD::ImageRef ir_rounded | ( | const tag::array< float, 2 > & | v | ) | [inline] |
Convert a float array into an image co-ordinate.
Numbers are rounded
v | The array to convert |
Definition at line 30 of file utility.h.
Referenced by compute_repeatability(), prune_warps(), and transform_offsets().
00031 { 00032 return CVD::ImageRef( 00033 static_cast<int>(v[0] > 0.0 ? v[0] + 0.5 : v[0] - 0.5), 00034 static_cast<int>(v[1] > 0.0 ? v[1] + 0.5 : v[1] - 0.5)); 00035 }