Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CalibratedPyramid.hh
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003-2009 (see file CONTACT for details)
4  Multimediale Systeme der Informationsverarbeitung
5  Institut fuer Informatik
6  Christian-Albrechts-Universitaet Kiel
7 
8 
9  BIAS is free software; you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation; either version 2.1 of the License, or
12  (at your option) any later version.
13 
14  BIAS is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with BIAS; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/
22 
23 #ifndef __CalibratedPyramid_hh__
24 #define __CalibratedPyramid_hh__
25 
26 #include <Base/Common/SharedPtr.hh>
27 #include <Image/PyramidImage.hh>
28 
29 namespace BIAS {
30 
31  // forwrad declarations
32  template <class T> class BIASImageBase_EXPORT Image;
33  class BIASGeometry_EXPORT ProjectionParametersBase;
34 
35  /** @class CalibratedImage
36  @relates CalibratedPyramid
37  @brief helper class holding image and associated calibration
38  @author woelk 12/2007 (c) www.vision-n.de */
39  template <class StorageType>
40  class BIASImage_EXPORT CalibratedImage
41  {
42  public:
45  };
46 
47 
48  /** @class CalibratedPyramid
49  @brief This class takes care of consisiten re-sampling of images and
50  associated ProjectionParameters.
51  @author woelk 12/2007 (c) www.vision-n.de */
52  template <class StorageType>
53  class BIASImage_EXPORT CalibratedPyramid
54  {
55  public:
57 
59 
61 
63 
64  /// initialization with original image, total number of images in the
65  /// pyramid and a rescale factor. A rescale factor of 4.0 means the
66  /// the image at pyramid level[i] has a quarter of the border lengths of
67  /// the image at pyramid level[i-1]. A rescale factor of 2.0 for example
68  /// represent a classical Gaussian pyramid.
69  void Init(const CalibratedImage<StorageType>& image,
70  const unsigned pyramid_size = 2,
71  const double rescale_factor = 4.0);
72 
73  /// clears the pyramid image and the internal vector,
74  /// does not explicitly delet the pointers
75  void Clear();
76 
77  /// check for emptyness
78  inline bool IsEmpty() const
79  { return Data_.empty(); }
80 
81  /// access operator
82  const CalibratedImage<StorageType>& operator[](const unsigned index) const
83  { return Data_[index]; }
84 
85  /// access operator
87  { return Data_[index]; }
88 
89  /// shallow copy operator, only copies the pointers
91  operator=(const CalibratedPyramid<StorageType>& cp);
92 
93  // coordinate transformation from level 0 -> index
94  void CoordinateTransf(const Vector2<double>& coo0, const unsigned index,
95  Vector2<double>& coo_index) const;
96 
97  /////////////////////////////////////////////////////
98  // get operators
99  /////////////////////////////////////////////////////
100 
101  /// returns the number of images stored in the pyramid
102  inline unsigned Size() const
103  { return PyramidImage_.GetPyramidSize(); };
104 
105  /// get the subsampling factor: 2.0 equals
106  inline double GetRescaleFactor() const
107  { return PyramidImage_.GetRescaleFactor(); }
108 
109  inline double GetPositionOffset() const
110  { return PyramidImage_.GetPositionOffset(); }
111 
112  protected:
113  /// Internal data: Data_.size() must always be equal to
114  /// PyramidImage_.GetPyramidSize()
115 
116  /// holds the images
118  /// holds the projection parameters and ptrs to the associated images
119  std::vector<CalibratedImage<StorageType> > Data_;
120 
121  /** Downsampling for factor 2 or 4, using a binomial lowpass filter. */
122  void Downsample_(SharedPtr<const Image<StorageType> > src,
124  const unsigned factor) const;
125 
127  };
128 
129 
130 
131 
132 } // namespace
133 
134 #endif // __CalibratedPyramid_hh__
135 
136 
137 
This class takes care of consisiten re-sampling of images and associated ProjectionParameters.
unsigned Size() const
returns the number of images stored in the pyramid
pointer with reference count and automatic deletion
Definition: SharedPtr.hh:50
const CalibratedImage< StorageType > & operator[](const unsigned index) const
access operator
PyramidImage< StorageType > PyramidImage_
Internal data: Data_.size() must always be equal to PyramidImage_.GetPyramidSize() ...
std::vector< CalibratedImage< StorageType > > Data_
holds the projection parameters and ptrs to the associated images
class BIASImageBase_EXPORT Image
Definition: ImageBase.hh:91
double GetRescaleFactor() const
get the subsampling factor: 2.0 equals
CalibratedImage< StorageType > & operator[](const unsigned index)
access operator
SharedPtr< Image< StorageType > > image
The image template class for specific storage types.
Definition: Image.hh:78
helper class holding image and associated calibration
double GetPositionOffset() const
SharedPtr< ProjectionParametersBase > projection
class BIASGeometry_EXPORT ProjectionParametersBase
bool IsEmpty() const
check for emptyness