Image Component Library (ICL)
Size.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 : ICLUtils/src/ICLUtils/Size.h **
10 ** Module : ICLUtils **
11 ** Authors: Christof Elbrechter, Robert Haschke **
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 <string>
35 #include <iostream>
36 
37 #ifdef ICL_HAVE_IPP
38 #include <ipp.h>
39 #endif
40 
41 namespace icl {
42  namespace utils{
43  #ifndef ICL_HAVE_IPP
44  struct IppiSize {
46  // width
47  int width;
48 
49  // height
50  int height;
51  };
52 
53  #else
54  #endif
55 
57  class Size32f;
60  class ICLUtils_API Size : public IppiSize{
62  public:
64  static const Size null;
65 
67  static const Size QQVGA;
68 
70  static const Size CGA;
71 
73  static const Size QVGA;
74 
76  static const Size HVGA;
77 
79  static const Size EGA;
80 
82  static const Size VGA;
83 
85  static const Size WVGA;
86 
88  static const Size SVGA;
89 
91  static const Size QHD;
92 
94  static const Size DVGA;
95 
97  static const Size XGA;
98 
100  static const Size XGAP;
101 
103  static const Size DSVGA;
104 
106  static const Size HD720;
107 
109  static const Size WXGA;
110 
112  static const Size WXGAP;
113 
115  static const Size SXVGA;
116 
118  static const Size SXGA;
119 
121  static const Size WSXGA;
122 
124  static const Size SXGAP;
125 
127  static const Size WSXGAP;
128 
130  static const Size UXGA;
131 
133  static const Size HD1080;
134 
136  static const Size WUXGA;
137 
139  static const Size UD;
140 
141 
142  // video formats
143 
145  static const Size CIF;
146 
148  static const Size SIF;
149 
151  static const Size SQCIF;
152 
154  static const Size QCIF;
155 
157  static const Size PAL;
158 
160  static const Size NTSC;
161 
163  inline Size(){ this->width = 0; this->height = 0; }
164 
166  inline Size(const Size &s){ this->width = s.width;this->height = s.height; }
167 
169  inline Size(int width,int height){ this->width = width; this->height = height; }
170 
172  explicit Size(const std::string &name);
173 
175  Size(const Size32f &other);
176 
178  bool isNull() const { return (*this)==null; }
179 
181  bool operator==(const Size &s) const {return width==s.width && height==s.height;}
182 
184  bool operator!=(const Size &s) const {return width!=s.width || height!=s.height;}
185 
187  Size operator+(const Size &s) const {return Size(width+s.width,height+s.height);}
188 
190  Size operator-(const Size &s) const {return Size(width-s.width,height-s.height);}
191 
193  Size operator*(double d) const { return Size((int)(d*width),(int)(d*height));}
194 
196  Size operator/(double d) const { return (*this)*(1.0/d); }
197 
199  Size& operator+=(const Size &s){width+=s.width; height+=s.height; return *this;}
200 
202  Size& operator-=(const Size &s){width-=s.width; height-=s.height; return *this;}
203 
205  Size& operator*=(double d) {width=(int)((float)width*d); height=(int)((float)height*d); return *this;};
206 
208  Size& operator/=(double d) { return (*this)*=(1.0/d); }
209 
211  int getDim() const {return width*height;}
212  };
213 
215  ICLUtils_API std::ostream &operator<<(std::ostream &os, const Size &s);
216 
218 
219  ICLUtils_API std::istream &operator>>(std::istream &is, Size &s);
220 
221  } // namespace utils
222 }// namespace icl
223 
static const Size WVGA
Wide VGA res. 800x480.
Definition: Size.h:85
Size operator-(const Size &s) const
substracts a size from another size
Definition: Size.h:190
undocument this line if you encounter any issues!
Definition: Any.h:37
static const Size CIF
Common Intermediate Format res. 352x288.
Definition: Size.h:145
static const Size XGAP
XGA Plus res. 1152 x 864.
Definition: Size.h:100
static const Size HD720
Half Definition res. 1280x720.
Definition: Size.h:106
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
Size & operator-=(const Size &s)
substracst another size inplace
Definition: Size.h:202
static const Size SXGA
Super XGA res. 1280x1024.
Definition: Size.h:118
static const Size WXGA
Wide XGA res. 1280x800.
Definition: Size.h:109
static const Size SVGA
Super VGA res. 800x600.
Definition: Size.h:88
static const Size WSXGA
Wide Super XGA res. 1600x900.
Definition: Size.h:121
static const Size HVGA
Half VGA res. 480x320.
Definition: Size.h:76
static const Size QQVGA
Quater QVGA res. 160x120.
Definition: Size.h:67
static const Size QHD
Quater HD res. 960x540.
Definition: Size.h:91
static const Size VGA
Video Graphics Array res. 640x480.
Definition: Size.h:82
Size(int width, int height)
creates a specified size
Definition: Size.h:169
Size & operator+=(const Size &s)
adds another size inplace
Definition: Size.h:199
static const Size SXGAP
Super XGA Plus res. 1400x1050.
Definition: Size.h:124
FixedMatrix< T, V_COLS, M_ROWS_AND_COLS > & operator *=(FixedMatrix< T, V_COLS, M_ROWS_AND_COLS > &v, const FixedMatrix< T, M_ROWS_AND_COLS, M_ROWS_AND_COLS > &m)
Matrix multiplication (inplace)
Definition: FixedMatrix.h:959
static const Size HD1080
High definition res. 1920x1080.
Definition: Size.h:133
Size class of the ICL.
Definition: Size.h:61
ICLUtils_API std::ostream & operator<<(std::ostream &s, const ConfigFile &cf)
Default ostream operator to put a ConfigFile into a stream.
static const Size PAL
Phase alternating Line res. 768x576 (many other formats are known as PAL)
Definition: Size.h:157
ICLUtils_API std::istream & operator>>(std::istream &s, Point &p)
istream operator
static const Size QCIF
Quater CIF res. 176x144.
Definition: Size.h:154
static const Size WUXGA
Wide UXGA res. 1920x1080.
Definition: Size.h:136
static const Size XGA
Extended Graphics Array res. 1024x768 (also known as EVGA)
Definition: Size.h:97
static const Size SIF
Source Imput Format res. 360x240.
Definition: Size.h:148
ICLQt_API ImgQ operator *(const ImgQ &a, const ImgQ &b)
multiplies two images pixel-wise
static const Size DSVGA
Double Super VGA res. 1200x800.
Definition: Size.h:103
static const Size WSXGAP
Wide Super XGA Plus res. 1600x1050.
Definition: Size.h:127
static const Size UD
Ultra Definietion res. 3840x2160.
Definition: Size.h:139
bool isNull() const
checks wether the object instance is null, i.e. all elements are zero
Definition: Size.h:178
Size()
default constructor
Definition: Size.h:163
static const Size QVGA
Qauter VGA res. 320x240.
Definition: Size.h:73
static const Size SXVGA
Quad VGA res. 1280x960.
Definition: Size.h:115
static const Size DVGA
Double VGA res. 960x640.
Definition: Size.h:94
Size & operator/=(double d)
scales the size parameters inplace by a scalar
Definition: Size.h:208
static const Size CGA
Color Graphics Adapter res. 320x200.
Definition: Size.h:70
static const Size SQCIF
Semi Quater CIF res. 128x96.
Definition: Size.h:151
bool operator!=(const Size &s) const
checks if two size are not equal
Definition: Size.h:184
Size32f class of the ICL (float valued)
Definition: Size32f.h:40
static const Size UXGA
Ultra XGA res. 1600x1200.
Definition: Size.h:130
Size operator+(const Size &s) const
add a size to another size
Definition: Size.h:187
static const Size NTSC
National Television System Commitee res. 640x480 (many other formats are known as NTSC)
Definition: Size.h:160
Size(const Size &s)
deep copy of another Size
Definition: Size.h:166
int getDim() const
reutrns width*height
Definition: Size.h:211
Size operator/(double d) const
scales the size by a scalar value
Definition: Size.h:196
static const Size WXGAP
Wide XGA Plus res. 1440x900.
Definition: Size.h:112
static const Size EGA
Enhanced Graphics Adapter res. 640x350.
Definition: Size.h:79
bool operator==(const Size &s) const
checks if two sizes are equal
Definition: Size.h:181