Image Component Library (ICL)
TiltedQuad.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLMarkers/src/ICLMarkers/TiltedQuad.h **
10 ** Module : ICLMarkers **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/Point32f.h>
35 #include <ICLCV/ImageRegion.h>
36 #include <algorithm>
37 
38 namespace icl{
39  namespace markers{
40 
41 
43 
47  class TiltedQuad{
48 
51 
54 
55  public:
56 
58  inline TiltedQuad():region(0){}
59 
61  inline TiltedQuad(const utils::Point32f &a, const utils::Point32f &b,
62  const utils::Point32f &c, const utils::Point32f &d,
63  const cv::ImageRegion r): region(r){
64  ps[0]=a; ps[1]=b; ps[2]=c; ps[3]=d;
65  }
66 
69  std::copy(ps,ps+4,this->ps);
70  }
71 
73  inline utils::Point32f &operator[](int i){ return ps[i]; }
74 
76  inline const utils::Point32f &operator[](int i) const{ return ps[i]; }
77 
79  cv::ImageRegion getRegion() const { return region; }
80 
82  void setRegion(cv::ImageRegion region){ this->region = region; }
83 
85  operator bool() const { return region; }
86 
88  const utils::Point32f *data() const { return ps; }
89  };
90  } // namespace markers
91 }
92 
93 
TiltedQuad(const utils::Point32f *ps, cv::ImageRegion r)
creates a TiltedQuad instance with given 4D array of points and image region
Definition: TiltedQuad.h:68
undocument this line if you encounter any issues!
Definition: Any.h:37
TiltedQuad()
creates a null-instance
Definition: TiltedQuad.h:58
Utility class that represents a tilted quad in an image.
Definition: TiltedQuad.h:47
void setRegion(cv::ImageRegion region)
sets the image region (this is usually not used explicitly)
Definition: TiltedQuad.h:82
utils::Point32f & operator[](int i)
accesses the i-th corner point
Definition: TiltedQuad.h:73
ImageRegion Structure providing region feature information.
Definition: ImageRegion.h:99
TiltedQuad(const utils::Point32f &a, const utils::Point32f &b, const utils::Point32f &c, const utils::Point32f &d, const cv::ImageRegion r)
creates a TiltedQuad instance with given 4 corners and given ImageRegion
Definition: TiltedQuad.h:61
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
const utils::Point32f & operator[](int i) const
accesses the i-th corner point (const)
Definition: TiltedQuad.h:76
cv::ImageRegion getRegion() const
returns the associated image region (always const)
Definition: TiltedQuad.h:79
const utils::Point32f * data() const
returns the internal utils::Point-data pointer
Definition: TiltedQuad.h:88
cv::ImageRegion region
associated image region
Definition: TiltedQuad.h:53
void copy(const T *src, const T *srcEnd, T *dst)
moves data from source to destination array (no casting possible)
Definition: CoreFunctions.h:216
utils::Point32f ps[4]
list of points (usually sorted in clock-wise order)
Definition: TiltedQuad.h:50