LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiGradientKernels.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*----------------------------------------------------------------
00025  * project ....: LTI Digital Image/Signal Processing Library
00026  * file .......: ltiGradientKernels.h
00027  * authors ....: Pablo Alvarado
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 11.07.00
00030  * revisions ..: $Id: ltiGradientKernels.h,v 1.8 2006/02/08 11:12:56 ltilib Exp $
00031  */
00032 
00033 /**
00034  * \file ltiGradientKernels.h Defines several linear kernels for the
00035  * computation of the gradient, like the Ando kernels, and other classical
00036  * ones like Sobel, Prewitt, etc.
00037  */ 
00038 
00039 #ifndef _LTI_GRADIENTKERNELS_H_
00040 #define _LTI_GRADIENTKERNELS_H_
00041 
00042 #include "ltiLinearKernels.h"
00043 #include <limits>
00044 
00045 namespace lti {
00046   /**
00047    * Two-dimensional separable filter kernels for the gradient approximation
00048    *
00049    * This class will create a two-dimensional gradient filter kernel.
00050    *
00051    * There are three posibilities for the kernel dimensions 3x3, 4x4 or 5x5.
00052    * The approximation is done using the suggestions of Ando in its paper
00053    * "Consistent Gradient Operators" (IEEE PAMI, Vol. 22, No. 3, March 2000)
00054    *
00055    * These suggested kernels are separable and are of course implemented that
00056    * way (much faster!)
00057    *
00058    * This object will correspond to the derivative respect the x-Axis.
00059    * For the y-Axis just exchange the 1D filter kernels, or use the
00060    * lti::gradientKernelY.
00061    *
00062    * The template parameter T should be the same as the value_type of
00063    * the matrix or channel to be filtered (channel::value_type, double, etc.)
00064    *
00065    * It is recomended to use this kernels with floating point matrices
00066    * or channels, due to precision aspects.
00067    *
00068    * @ingroup gLinearFilters
00069    */
00070   template<class T>
00071   class gradientKernelX : public sepKernel<T> {
00072   public:
00073     /**
00074      * constructor
00075      * @param size is the dimension of the one dimensional part (i.e. the
00076      *             filter kern is a size x size kernel!)
00077      *             The valid values are 3, 4 or 5.  If an invalid value is
00078      *             given, an empty kernel will be created.
00079      */
00080     gradientKernelX(const int& size = 3);
00081 
00082     /**
00083      * initialize this kernel with the specified values
00084      * @param size size of the kernel in one dimension
00085      */
00086     void generate(const int& size);
00087   };
00088 
00089   /**
00090    * Two-dimensional separable filter kernels for the gradient approximation
00091    *
00092    * This class will create a two-dimensional gradientian filter kernel.
00093    *
00094    * There are three posibilities for the kernel dimensions 3x3, 4x4 or 5x5.
00095    * The approximation is done using the suggestions of Ando in its paper
00096    * "Consistent Gradient Operators" (IEEE PAMI, Vol. 22, No. 3, March 2000)
00097    *
00098    * These suggested kernels are separable and are of course implemented that
00099    * way (much faster!)
00100    *
00101    * This object will correspond to the derivative respect the y-Axis.
00102    * For the x-Axis just exchange the 1D filter kernels, or use the
00103    * lti::gradientKernelX .
00104    *
00105    * The template parameter T should be the same as the value_type of
00106    * the matrix or channel to be filtered (channel::value_type, double, etc.)
00107    *
00108    * It is recomended to use this kernels with floating point matrices
00109    * or channels, due to precision aspects.
00110    *
00111    * @ingroup gLinearFilters
00112    */
00113   template<class T>
00114   class gradientKernelY : public sepKernel<T> {
00115   public:
00116     /**
00117      * constructor
00118      *
00119      * @param size is the dimension of the one dimensional part
00120      *             (i.e. the filter kern is a size x size kernel!)  The valid
00121      *             values are 3, 4 or 5.  If an invalid value is given, an
00122      *             empty kernel will be created.
00123      */
00124     gradientKernelY(const int& size = 3);
00125 
00126     /**
00127      * initialize this kernel with the specified values
00128      * @param size size of the kernel in one dimension.
00129      */
00130     void generate(const int& size);
00131   };
00132 
00133   /**
00134    * Sobel Kernel X
00135    *
00136    * Define as a 3x3 separable kernel:
00137    *
00138    * \code
00139    * -1  0  1
00140    * -2  0  2
00141    * -1  0  1
00142    * \endcode
00143    */
00144   template<class T>
00145   class sobelKernelX : public sepKernel<T> {
00146   public:
00147     /**
00148      * Constructor
00149      *
00150      * @param normalized if true, the kernel will be normalized so that
00151      *        in the low-pass axis (perpendicular to the gradient axis)
00152      *        the mean value remains the same, i.e. the kernel will be 
00153      *        multiplied by 1/4.
00154      */
00155     sobelKernelX(const bool normalized = false);
00156   };
00157 
00158   /**
00159    * Sobel Kernel Y
00160    *
00161    * Defined as a 3x3 separable kernel:
00162    *
00163    * \code
00164    * -1 -2 -1
00165    *  0  0  0
00166    *  1  2  1
00167    * \endcode
00168    */
00169   template<class T>
00170   class sobelKernelY : public sepKernel<T> {
00171   public:
00172     /**
00173      * Constructor
00174      *
00175      * @param normalized if true, the kernel will be normalized so that
00176      *        in the low-pass axis (perpendicular to the gradient axis)
00177      *        the mean value remains the same, i.e. the kernel will be 
00178      *        multiplied by 1/4.
00179      */
00180     sobelKernelY(const bool normalized = false);
00181   };
00182 
00183   /**
00184    * Prewitt Kernel X
00185    *
00186    * Define as a 3x3 separable kernel:
00187    *
00188    * \code
00189    * -1  0  1
00190    * -1  0  1
00191    * -1  0  1
00192    * \endcode
00193    */
00194   template<class T>
00195   class prewittKernelX : public sepKernel<T> {
00196   public:
00197     /**
00198      * Constructor
00199      *
00200      * @param normalized if true, the kernel will be normalized so that
00201      *        in the low-pass axis (perpendicular to the gradient axis)
00202      *        the mean value remains the same, i.e. the kernel will be 
00203      *        multiplied by 1/3.
00204      */
00205     prewittKernelX(const bool normalized = false);
00206   };
00207 
00208   /**
00209    * Prewitt Kernel Y
00210    *
00211    * Defined as a 3x3 separable kernel:
00212    *
00213    * \code
00214    * -1 -1 -1
00215    *  0  0  0
00216    *  1  1  1
00217    * \endcode
00218    */
00219   template<class T>
00220   class prewittKernelY : public sepKernel<T> {
00221   public:
00222     /**
00223      * Constructor
00224      *
00225      * @param normalized if true, the kernel will be normalized so that
00226      *        in the low-pass axis (perpendicular to the gradient axis)
00227      *        the mean value remains the same, i.e. the kernel will be 
00228      *        multiplied by 1/3.
00229      */
00230     prewittKernelY(const bool normalized = false);
00231   };
00232 
00233   /**
00234    * Harris Kernel X
00235    *
00236    * This is the kernel used for the famed Harris Corner Detector
00237    * introduced in:
00238    *
00239    * C. Harris and M. Stephens, "A Combined Corner and Edge Detector",
00240    * in Proc. 4th Alvey Vision Conference, pp. 147-151, 1988
00241    *
00242    * Define as a 1x5 separable kernel:
00243    *
00244    * \code
00245    * -2 -1  0  1 2
00246    * \endcode
00247    */
00248   template<class T>
00249   class harrisKernelX : public sepKernel<T> {
00250   public:
00251     /**
00252      * Constructor
00253      *
00254      * There is no normalization option as with other gradient kernels
00255      * since the harris kernel does not have a low-pass component.
00256      */
00257     harrisKernelX();
00258   };
00259 
00260   /**
00261    * Harris Kernel Y
00262    *
00263    * This is the kernel used for the famed Harris Corner Detector
00264    * introduced in:
00265    *
00266    * C. Harris and M. Stephens, "A Combined Corner and Edge Detector",
00267    * in Proc. 4th Alvey Vision Conference, pp. 147-151, 1988
00268    *
00269    * Define as a 5x1 separable kernel:
00270    *
00271    * \code
00272    * [-2 -1  0  1 2] transposed
00273    * \endcode
00274    */
00275   template<class T>
00276   class harrisKernelY : public sepKernel<T> {
00277   public:
00278     /**
00279      * Constructor
00280      *
00281      * There is no normalization option as with other gradient kernels
00282      * since the harris kernel does not have a low-pass component.
00283      */
00284     harrisKernelY();
00285   };
00286 
00287   /**
00288    * Robinson Kernel X
00289    *
00290    * Define as a 3x3 2D (non-separable) kernel:
00291    *
00292    * \code
00293    * -1   1  1
00294    * -1  -2  1
00295    * -1   1  1
00296    * \endcode
00297    */
00298   template<class T>
00299   class robinsonKernelX : public kernel2D<T> {
00300   public:
00301     /**
00302      * Constructor
00303      */
00304     robinsonKernelX();
00305   };
00306 
00307   /**
00308    * Robinson Kernel Y
00309    *
00310    * Defined as a 3x3 2D (non separable) kernel:
00311    *
00312    * \code
00313    * -1 -1 -1
00314    *  1 -2  1
00315    *  1  1  1
00316    * \endcode
00317    */
00318   template<class T>
00319   class robinsonKernelY : public kernel2D<T> {
00320   public:
00321     /**
00322      * Constructor
00323      */
00324     robinsonKernelY();
00325   };
00326 
00327   /**
00328    * Kirsch Kernel X
00329    *
00330    * Defined as a 3x3 2D (non-separable) kernel:
00331    *
00332    * \code
00333    * -5   3  3
00334    * -5   0  3
00335    * -5   3  3
00336    * \endcode
00337    */
00338   template<class T>
00339   class kirschKernelX : public kernel2D<T> {
00340   public:
00341     /**
00342      * Constructor
00343      */
00344     kirschKernelX();
00345   };
00346 
00347   /**
00348    * Kirsch Kernel Y
00349    *
00350    * Defined as a 3x3 2D (non-separable) kernel:
00351    *
00352    * \code
00353    * -5 -5 -5
00354    *  3  0  3
00355    *  3  3  3
00356    * \endcode
00357    */
00358   template<class T>
00359   class kirschKernelY : public kernel2D<T> {
00360   public:
00361     /**
00362      * Constructor
00363      */
00364     kirschKernelY();
00365   };
00366 
00367 }
00368 
00369 #include "ltiGradientKernels_template.h"
00370 
00371 #endif

Generated on Sat Apr 10 15:25:36 2010 for LTI-Lib by Doxygen 1.6.1