bazar  1.3.1
pyrimage.h
Go to the documentation of this file.
1 /*
2 Copyright 2005, 2006 Computer Vision Lab,
3 Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland.
4 All rights reserved.
5 
6 This file is part of BazAR.
7 
8 BazAR is free software; you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 BazAR is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License along with
18 BazAR; if not, write to the Free Software Foundation, Inc., 51 Franklin
19 Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21 #ifndef PYRIMAGE_H
22 #define PYRIMAGE_H
23 
24 #include <cv.h>
25 
26 #ifdef WIN32 // disable warning :
27 #pragma warning( disable : 4127 ) // (/W4) conditional expression is constant
28 #pragma warning( disable : 4512 ) // (/W4) assignment operator could not be generated
29 #pragma warning( disable : 4288 ) // (/W1) loop control variable declared in the for-loop is used outside the for-loop scope
30 #endif
31 
33 
40 class PyrImage {
41 public:
42  PyrImage(IplImage *im, int nblev);
43  ~PyrImage();
44 
46  void build();
47 
50  static PyrImage *load(int level, const char *filename, int color, bool fatal = true);
51 
53  /* \param x the coordinate to translate
54  * \param from the level in which x is specified
55  * \param to the level to translate the coordinate into
56  * \param method controls whether to return minimum or maximum possible
57  * coordinate, when translating from high to low levels.
58  * 0 : return the minimum possible value
59  * 1 : return the maximum possible value
60  * 2 : return the average possible value
61  * \return the translate coordinate
62  */
63  static int convCoord(int x, int from, int to=0, unsigned method = 0);
64 
66  static float convCoordf(float x, int from, int to=0);
67 
69 
75  void setPixel(unsigned x, unsigned y, CvScalar& val);
76 
78  void set(CvScalar val = cvScalarAll(0));
79 
81  PyrImage *clone() const;
82 
83  IplImage *operator[](unsigned i) {return images[i];}
84 
86  void smoothLevel0(int kernelSize=3)
87  {
88  cvSmooth(images[0], images[0], CV_GAUSSIAN, kernelSize, kernelSize);
89  }
90 
92  void setImageROI(CvRect rect);
93 
95  void resetImageROI();
96 
97  const int nbLev;
98  IplImage **images;
99 };
100 
101 #endif // PYRIMAGE_H
102