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

ltiBinaryKernels.h

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 .......: ltiBinaryKernels.h
00027  * authors ....: Pablo Alvarado
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 15.08.00
00030  * revisions ..: $Id: ltiBinaryKernels.h,v 1.5 2006/02/07 18:30:30 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_BINARYKERNELS_H_
00034 #define _LTI_BINARYKERNELS_H_
00035 
00036 #include "ltiLinearKernels.h"
00037 
00038 namespace lti {
00039 
00040   /**
00041    * cityBlock filter kernel
00042    *
00043    * This binary filter kernel (values only 0 or \p onValue) is used
00044    * as a structuring element for erosion/dilation operations.
00045    *
00046    * The onValue is important if e.g. erosion::parameters::Gray is
00047    * used. For Binary mode the exact value of onValue is not
00048    * relevant. Default is typeInfo<T>::suggestedNorm()/255, i.e. 1 for
00049    * ubyte and 0.003921 for float.
00050    *
00051    * The possible sizes are all odd values greater/equal 3.
00052    *
00053    * The kernel norm is set to the typeInfo<T>::suggestedNorm() so the
00054    * result is the expected black and white image.
00055    *
00056    * An example of a city block kernel of size seven:
00057    *
00058    * \code
00059    *          - - - 1 - - -
00060    *          - - 1 1 1 - -
00061    *          - 1 1 1 1 1 -
00062    *          1 1 1 1 1 1 1
00063    *          - 1 1 1 1 1 -
00064    *          - - 1 1 1 - -
00065    *          - - - 1 - - -
00066    * \endcode
00067    */
00068   template<class T=float>
00069   class cityBlockKernel : public kernel2D<T> {
00070   public:
00071     /**
00072      * constructor
00073      * @param size is the dimension of the one dimensional part (i.e. the
00074      *             filter kern is a size x size kernel!)
00075      *             This must be an odd value greater/equal 3.  If another
00076      *             value is given, the next valid odd value will be assumed.
00077      * @param onValue value different from zero in the kernel.
00078      */
00079     cityBlockKernel(const int& size = 3,
00080                     const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00081 
00082     /**
00083      * initialize this kernel with the specified values
00084      * @param size is the dimension of the one dimensional part (i.e. the
00085      *             filter kern is a size x size kernel!)
00086      *             This must be an odd value greater/equal 3.  If another
00087      *             value is given, the next valid odd value will be assumed.
00088      * @param onValue value different from zero in the kernel.
00089      */
00090     void generate(const int& size,
00091                   const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00092   };
00093 
00094   /**
00095    * chessboard filter kernel or square filter kernel
00096    *
00097    * This binary filter kernel (values only 0 or 1) is used as a structuring
00098    * element for erosion/dilation operations
00099    *
00100    * The onValue is important if e.g. erosion::parameters::Gray is
00101    * used. For Binary mode the exact value of onValue is not
00102    * relevant. Default is typeInfo<T>::suggestedNorm()/255, i.e. 1 for
00103    * ubyte and 0.003921 for float.
00104    *
00105    * The possible sizes are all odd values greater/equal 3.
00106    *
00107    * The kernel norm is set to the typeInfo<T>::suggestedNorm() so the
00108    * result is the expected black and white image.
00109    *
00110    * An example of a chessboard kernel of size seven:
00111    *
00112    * \code
00113    *          1 1 1 1 1 1 1
00114    *          1 1 1 1 1 1 1
00115    *          1 1 1 1 1 1 1
00116    *          1 1 1 1 1 1 1
00117    *          1 1 1 1 1 1 1
00118    *          1 1 1 1 1 1 1
00119    *          1 1 1 1 1 1 1
00120    * \endcode
00121    */
00122   template<class T=float>
00123   class chessBoardKernel : public sepKernel<T> {
00124   public:
00125     /**
00126      * constructor
00127      * @param size is the dimension of the one dimensional part (i.e. the
00128      *             filter kern is a size x size kernel!)
00129      *             This must be an odd value greater/equal 3.  If another
00130      *             value is given, the next valid odd value will be assumed.
00131      * @param onValue value different from zero in the kernel.
00132      */
00133     chessBoardKernel(const int& size = 3,
00134                      const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00135 
00136     /**
00137      * initialize this kernel with the specified values
00138      * @param size is the dimension of the one dimensional part (i.e. the
00139      *             filter kern is a size x size kernel!)
00140      *             This must be an odd value greater/equal 3.  If another
00141      *             value is given, the next valid odd value will be assumed.
00142      * @param onValue value different from zero in the kernel.
00143      */
00144     void generate(const int& size,
00145                   const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00146   };
00147 
00148   /**
00149    * octagonal filter kernel
00150    *
00151    * This binary filter kernel (values only 0 or 1) is used as a structuring
00152    * element for erosion/dilation operations
00153    *
00154    * The onValue is important if e.g. erosion::parameters::Gray is
00155    * used. For Binary mode the exact value of onValue is not
00156    * relevant. Default is typeInfo<T>::suggestedNorm()/255, i.e. 1 for
00157    * ubyte and 0.003921 for float.
00158    *
00159    * The possible sizes are all odd values greater/equal 3.
00160    *
00161    * The kernel norm is set to the typeInfo<T>::suggestedNorm() so the
00162    * result is the expected black and white image.
00163    *
00164    * An example of an octagonal kernel of size seven:
00165    *
00166    * \code
00167    *          - - 1 1 1 - -
00168    *          - 1 1 1 1 1 -
00169    *          1 1 1 1 1 1 1
00170    *          1 1 1 1 1 1 1
00171    *          1 1 1 1 1 1 1
00172    *          - 1 1 1 1 1 -
00173    *          - - 1 1 1 - -
00174    * \endcode
00175    */
00176   template<class T=float>
00177   class octagonalKernel : public kernel2D<T> {
00178   public:
00179     /**
00180      * constructor
00181      * @param size is the dimension of the one dimensional part (i.e. the
00182      *             filter kern is a size x size kernel!)
00183      *             This must be an odd value greater/equal 3.  If another
00184      *             value is given, the next valid odd value will be assumed.
00185      * @param onValue value different from zero in the kernel.
00186      */
00187     octagonalKernel(const int& size = 3,
00188                     const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00189 
00190     /**
00191      * initialize this kernel with the specified values
00192      * @param size is the dimension of the one dimensional part (i.e. the
00193      *             filter kern is a size x size kernel!)
00194      *             This must be an odd value greater/equal 3.  If another
00195      *             value is given, the next valid odd value will be assumed.
00196      * @param onValue value different from zero in the kernel.
00197      */
00198     void generate(const int& size,
00199                   const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00200   };
00201 
00202   /**
00203    * euclidean filter kernel
00204    *
00205    * This binary filter kernel (values only 0 or 1) is used as a structuring
00206    * element for erosion/dilation operations. It is equivalent to a circle.
00207    *
00208    * The onValue is important if e.g. erosion::parameters::Gray is
00209    * used. For Binary mode the exact value of onValue is not
00210    * relevant. Default is typeInfo<T>::suggestedNorm()/255, i.e. 1 for
00211    * ubyte and 0.003921 for float.
00212    *
00213    * The possible sizes are all odd values greater/equal 3.
00214    *
00215    * The kernel norm is set to the typeInfo<T>::suggestedNorm() so the
00216    * result is the expected black and white image.
00217    *
00218    * An example of an euclidean kernel of size nine:
00219    *
00220    * \code
00221    *          - - - - 1 - - - -
00222    *          - - 1 1 1 1 1 - -
00223    *          - 1 1 1 1 1 1 1 -
00224    *          - 1 1 1 1 1 1 1 -
00225    *          1 1 1 1 1 1 1 1 1
00226    *          - 1 1 1 1 1 1 1 -
00227    *          - 1 1 1 1 1 1 1 -
00228    *          - - 1 1 1 1 1 - -
00229    *          - - - - 1 - - - -
00230    * \endcode
00231    */
00232   template<class T=float>
00233   class euclideanKernel : public kernel2D<T> {
00234   public:
00235     /**
00236      * constructor
00237      * @param size is the dimension of the one dimensional part (i.e. the
00238      *             filter kern is a size x size kernel!)
00239      *             This must be an odd value greater/equal 3.  If another
00240      *             value is given, the next valid odd value will be assumed.
00241      * @param onValue value different from zero in the kernel.
00242      */
00243     euclideanKernel(const int& size = 3,
00244                     const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00245 
00246     /**
00247      * initialize this kernel with the specified values
00248      * @param size is the dimension of the one dimensional part (i.e. the
00249      *             filter kern is a size x size kernel!)
00250      *             This must be an odd value greater/equal 3.  If another
00251      *             value is given, the next valid odd value will be assumed.
00252      * @param onValue value different from zero in the kernel.
00253      */
00254     void generate(const int& size,
00255                   const T& onValue=lti::typeInfo<T>::suggestedNorm()/T(255));
00256   };
00257 
00258 }
00259 
00260 #include "ltiBinaryKernels_template.h"
00261 
00262 #endif

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