X-Boost  2.3.8
Types.h
Go to the documentation of this file.
1 /* XBoost: Ada-Boost and Friends on Haar/ICF/HOG Features, Library and ToolBox
2  *
3  * Copyright (c) 2008-2014 Paolo Medici <medici@ce.unipr.it>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _XBOOST_TYPES_H
22 #define _XBOOST_TYPES_H
23 
24 
28 #include <iosfwd>
29 
36 };
37 
39 struct size {
40  unsigned int width, height;
41 
42  size() : width(0), height(0) { }
43  size(unsigned int _w, unsigned int _h) : width(_w), height(_h) { }
44 
45  inline bool operator == (const size & s) const
46  {
47  return width == s.width && height == s.height;
48  }
49 };
50 
53 
55 struct rect {
56  int x0,y0,x1,y1;
57 
58  rect() {}
59  rect(int _x0,int _y0,int _x1, int _y1) : x0(_x0), y0(_y0), x1(_x1), y1(_y1) {}
60 
61  inline int width() const { return x1 - x0; }
62  inline int height() const { return y1 - y0; }
63  inline size extension() const { return size(x1 - x0, y1 - y0); }
64 
65  inline bool operator == (const rect & r) const
66  {
67  return x0 == r.x0 && y0 == r.y0 && x1 == r.x1 && y1 == r.y1;
68  }
69 };
70 
71 std::ostream & operator << (std::ostream & out, const rect & src);
72 
74 bool overlap(const rect &a, const rect & b);
75 
76 enum OverlapCriterion {
77  Overlap_On_Union,
78  Overlap_On_First,
79  Overlap_On_Second,
80  Overlap_On_Min,
81  Overlap_On_Max
82 };
83 
85 double boxoverlap(rect a, rect b, OverlapCriterion criterion = Overlap_On_Union);
86 
87 #endif
a dicrete classifier with abstention returns {-1,0,+1}
Definition: Types.h:33
ClassifierType
Definition: Types.h:31
image/size TODO namespace
Definition: Types.h:39
double boxoverlap(rect a, rect b, OverlapCriterion criterion=Overlap_On_Union)
get overlapped area
a FeatureExtractor return a scalar number without relationship with classification ...
Definition: Types.h:35
bool overlap(const rect &a, const rect &b)
test if 2 rect are overlapped
a rectangle structure
Definition: Types.h:55
a real classifier return a number between -1,+1
Definition: Types.h:34
a dicrete classifier returns {-1,+1}
Definition: Types.h:32
size template_geometry
normally referred as template_geometry
Definition: Types.h:52