Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Size.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLUtils/src/ICLUtils/Size.h                           **
00010 ** Module : ICLUtils                                               **
00011 ** Authors: Christof Elbrechter, Robert Haschke                    **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.GPL  **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #ifdef HAVE_IPP
00034 #include <ipp.h>
00035 #endif
00036 
00037 #include <string>
00038 #include <iostream>
00039 
00040 namespace icl {
00041   namespace utils{
00042   #ifndef HAVE_IPP
00043 
00044     struct IppiSize {
00045       // width
00046       int width;
00047       
00048       // height
00049       int height;
00050     };
00051   
00052   #else
00053   #endif
00054     
00056     class Size32f;
00059 
00060     class Size : public IppiSize{
00061       public:
00063       static const Size null;
00064       
00066       static const Size QQVGA;
00067       
00069       static const Size CGA;
00070   
00072       static const Size QVGA;
00073       
00075       static const Size HVGA;
00076   
00078       static const Size EGA;
00079   
00081       static const Size VGA;
00082   
00084       static const Size WVGA;
00085   
00087       static const Size SVGA;
00088   
00090       static const Size QHD;
00091   
00093       static const Size DVGA;
00094   
00096       static const Size XGA;
00097       
00099       static const Size XGAP;
00100   
00102       static const Size DSVGA;
00103   
00105       static const Size HD720;
00106   
00108       static const Size WXGA;
00109   
00111       static const Size WXGAP;
00112   
00114       static const Size SXVGA;
00115   
00117       static const Size SXGA;
00118   
00120       static const Size WSXGA;
00121   
00123       static const Size SXGAP;
00124   
00126       static const Size WSXGAP;
00127   
00129       static const Size UXGA;
00130   
00132       static const Size HD1080;
00133   
00135       static const Size WUXGA;
00136   
00138       static const Size UD;
00139   
00140   
00141       // video formats
00142       
00144       static const Size CIF;
00145       
00147       static const Size SIF;
00148   
00150       static const Size SQCIF;
00151   
00153       static const Size QCIF;
00154   
00156       static const Size PAL;
00157   
00159       static const Size NTSC;
00160   
00162       inline Size(const Size &s=null){ this->width = s.width;this->height = s.height; }
00163       
00165       inline Size(int width,int height){ this->width = width; this->height = height; }
00166   
00168       explicit Size(const std::string &name);
00169       
00171       Size(const Size32f &other);
00172       
00174       bool isNull() const { return (*this)==null; }
00175   
00177       bool operator==(const Size &s) const {return width==s.width && height==s.height;}
00178   
00180       bool operator!=(const Size &s) const {return width!=s.width || height!=s.height;}
00181   
00183       Size operator+(const Size &s) const {return  Size(width+s.width,height+s.height);}
00184   
00186       Size operator-(const Size &s) const {return  Size(width-s.width,height-s.height);}
00187   
00189       Size operator*(double d) const { return Size((int)(d*width),(int)(d*height));}
00190   
00192       Size operator/(double d) const { return (*this)*(1.0/d); }
00193       
00195       Size& operator+=(const Size &s){width+=s.width; height+=s.height; return *this;}
00196   
00198       Size& operator-=(const Size &s){width-=s.width; height-=s.height; return *this;}
00199   
00201       Size& operator*=(double d) {width=(int)((float)width*d); height=(int)((float)height*d); return *this;};
00202   
00204       Size& operator/=(double d) { return (*this)*=(1.0/d); }
00205       
00207       int getDim() const {return width*height;}
00208     };
00209   
00211     std::ostream &operator<<(std::ostream &os, const Size &s);
00212     
00214 
00215     std::istream &operator>>(std::istream &is, Size &s);
00216     
00217   } // namespace utils
00218 }// namespace icl
00219 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines