ACT-CV - Machine Vision for Cognitive Modeling
RegionInfo.h
Go to the documentation of this file.
1 // -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; coding: iso-8859-1; -*-
2 
3 /*
4 ACT-CV - Machine Vision for Cognitive Modeling
5 Copyright (c) 2013 Marc Halbruegge
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
27 #pragma once
28 
29 #include <string>
30 
32 struct RegionInfo {
33  int left;
34  int top;
35  int right;
36  int bottom;
37 
38  std::string info;
39 
40  RegionInfo(int l=0, int t=0, int r=0, int b=0, const std::string& i="")
41  : left(l),
42  top(t),
43  right(r),
44  bottom(b),
45  info(i)
46  {}
47 
48  bool operator<(const RegionInfo &b) const {
49  if(left < b.left) return true;
50  else if(b.left < left) return false;
51  if(top < b.top) return true;
52  else if(b.top < top) return false;
53  if(right < b.right) return true;
54  else if(b.right < right) return false;
55  if(bottom < b.bottom) return true;
56  else if(b.bottom < bottom) return false;
57  if(info < b.info) return true;
58  else if(b.info < info) return false;
59 
60  return false;
61  }
62 
63  bool operator==(const RegionInfo &b) const {
64  return left == b.left
65  && top == b.top
66  && right == b.right
67  && bottom == b.bottom
68  && info == b.info;
69  }
70 
71 };
72 
73 static std::ostream& operator << (std::ostream& o, const RegionInfo& info) {
74  o << info.left << " "
75  << info.top << " "
76  << info.right << " "
77  << info.bottom << " "
78  << info.info;
79  return o;
80 }


ACT-CV - Machine Vision for Cognitive Modeling
© 2015 Marc Halbruegge (actcvlibrary@googlemail.com)