iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rescale.H
Go to the documentation of this file.
1 /*! @file
2  @author David J. Berg <dbeg@usc.edu>
3  @copyright GNU Public License (GPL v3)
4  @section License
5  @verbatim
6  // ////////////////////////////////////////////////////////////////////////
7  // The iLab Neuromorphic Robotics Toolkit (NRT) //
8  // Copyright 2010-2012 by the University of Southern California (USC) //
9  // and the iLab at USC. //
10  // //
11  // iLab - University of Southern California //
12  // Hedco Neurociences Building, Room HNB-10 //
13  // Los Angeles, Ca 90089-2520 - USA //
14  // //
15  // See http://ilab.usc.edu for information about this project. //
16  // ////////////////////////////////////////////////////////////////////////
17  // This file is part of The iLab Neuromorphic Robotics Toolkit. //
18  // //
19  // The iLab Neuromorphic Robotics Toolkit is free software: you can //
20  // redistribute it and/or modify it under the terms of the GNU General //
21  // Public License as published by the Free Software Foundation, either //
22  // version 3 of the License, or (at your option) any later version. //
23  // //
24  // The iLab Neuromorphic Robotics Toolkit is distributed in the hope //
25  // that it will be useful, but WITHOUT ANY WARRANTY; without even the //
26  // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
27  // PURPOSE. See the GNU General Public License for more details. //
28  // //
29  // You should have received a copy of the GNU General Public License //
30  // along with The iLab Neuromorphic Robotics Toolkit. If not, see //
31  // <http://www.gnu.org/licenses/>. //
32  // ////////////////////////////////////////////////////////////////////////
33  @endverbatim */
34 
35 
36 #ifndef INCLUDE_NRT_IMAGEPROC_RESHAPING_RESCALE_H
37 #define INCLUDE_NRT_IMAGEPROC_RESHAPING_RESCALE_H
38 
39 #include <nrt/Core/Image/Image.H>
41 
43 
44 namespace nrt
45 {
46  /*! @defgroup imagereshaping Image Reshaping Operations
47  Methods for resizing/reshaping/transforming Images
48 
49  \ingroup imageproc
50  \see image */
51 
52  /*! @defgroup imagerescale Image Rescaling Operations
53  These methods perform various rescaling operations on Images.
54  \todo Make some nice forwarding methods (e.g. just decimate(), rescale() (which would decide
55  whether do call downsize, or rescaleBilinear), etc..)
56 
57  \ingroup imagereshaping
58  \see imagepromo */
59 
60  /*! @{ */ // **********************************************************************
61 
62  //! Scale to new width & height using bilinear interpolation.
63  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
64  Image<DestType> rescaleBilinear(Image<PixType> const & src, Dims<int32> const & dims);
65 
66  //! Scale to new width & height using bilinear interpolation - GenericImage version.
67  template <typename promo = void>
68  GenericImage rescaleBilinear(GenericImage const & src, Dims<int32> const & dims);
69 
70  //! Decimate in X (take one every 'factor' pixels).
71  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
72  nrt::Image<DestType> decimateX(nrt::Image<PixType> const & src, int factor = 2);
73 
74  //! Decimate in Y (take one every 'factor' pixels).
75  /*! \ingroup imagerescale */
76  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
77  nrt::Image<DestType> decimateY(nrt::Image<PixType> const & src, int const factor = 2);
78 
79  //! Decimate in X and Y (take one every 'factor' pixels).
80  /*! @param src source Image
81  @param xfactor factor by which to decimate in the x direction
82  @param yfactor factor by which to decimate in the y direction;
83  if this value is less than zero, then just take yfactor=xfactor */
84  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
85  nrt::Image<DestType> decimateXY(nrt::Image<PixType> const & src, int const xfactor = 2, int const yfactor = -1);
86 
87  //! Downsize using alternating lowpass/decimate operations.
88  /*! The width used internally in the lowpass filters is given by filterWidth (default = 9).
89  \note The dims parameter must have the same aspect ratio as src.dims().
90  \todo This seems to not work */
91  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
93  int const filterWidth = 9);
94 
95  //! Low-pass filter, Anderson's 5x5 separable, applied in X, and X decimated by factor
96  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
97  nrt::Image<DestType> lowPass5xDecX(nrt::Image<PixType> const & src, int const factor = 2);
98 
99  //! Low-pass filter, Anderson's 5x5 separable, applied in Y, and Y decimated by factor
100  template <NRT_PROMOTE_PIX_NO_DEFAULT_PROMO>
101  nrt::Image<DestType> lowPass5yDecY(nrt::Image<PixType> const & src, int const factor = 2);
102 
103  /*! @} */ // **********************************************************************
104 
105 } // namespace nrt
106 
108 
109 #endif // INCLUDE_NRT_IMAGEPROC_RESHAPING_RESCALE_H