OTB  9.0.0
Orfeo Toolbox
grmDataStructures.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Generic Region Merging Library
4  Language: C++
5  author: Lassalle Pierre
6  contact: lassallepierre34@gmail.com
7 
8 
9 
10  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef GRM_DATA_STRUCTURES_H
19 #define GRM_DATA_STRUCTURES_H
20 #include <stdexcept>
21 #include <bitset>
22 #include <vector>
23 #include <algorithm>
24 
25 namespace grm
26 {
27 
28  struct BoundingBox
29  {
30  /* X coordinate of the upper left. */
31  long unsigned int m_UX;
32 
33  /* Y coordinate of the upper left. */
34  long unsigned int m_UY;
35 
36  /* Width */
37  unsigned int m_W;
38 
39  /* Height */
40  unsigned int m_H;
41  };
42 
44  const BoundingBox& bb2)
45  {
46  long unsigned int min_ux, min_uy, max_xw, max_yh;
47  BoundingBox bb;
48 
49  min_ux = std::min(bb1.m_UX, bb2.m_UX);
50  min_uy = std::min(bb1.m_UY, bb2.m_UY);
51  max_xw = std::max(bb1.m_UX + bb1.m_W, bb2.m_UX + bb2.m_W);
52  max_yh = std::max(bb1.m_UY + bb1.m_H, bb2.m_UY + bb2.m_H);
53 
54  bb.m_UX = min_ux;
55  bb.m_UY = min_uy;
56  bb.m_W = max_xw - min_ux;
57  bb.m_H = max_yh - min_uy;
58 
59  return bb;
60  }
61 
62 } // end of namespace grm
63 
64 #endif
grm
Definition: grmBaatzSegmenter.h:22
grm::BoundingBox::m_H
unsigned int m_H
Definition: grmDataStructures.h:40
grm::BoundingBox::m_W
unsigned int m_W
Definition: grmDataStructures.h:37
grm::BoundingBox
Definition: grmDataStructures.h:28
grm::BoundingBox::m_UX
long unsigned int m_UX
Definition: grmDataStructures.h:31
grm::MergeBoundingBoxes
BoundingBox MergeBoundingBoxes(const BoundingBox &bb1, const BoundingBox &bb2)
Definition: grmDataStructures.h:43
grm::BoundingBox::m_UY
long unsigned int m_UY
Definition: grmDataStructures.h:34