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

ltiTriangularKernels.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 .......: ltiTriangularKernels.h
00027  * authors ....: Suat Akyol
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 28.04.00
00030  * revisions ..: $Id: ltiTriangularKernels.h,v 1.3 2006/02/08 11:58:05 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_TRIANGULARKERNELS_H_
00034 #define _LTI_TRIANGULARKERNELS_H_
00035 
00036 #include "ltiLinearKernels.h"
00037 
00038 namespace lti {
00039   /**
00040    *  one-dimensional filter kernel
00041    *
00042    *  This class will create a one-dimensional triangular filter kernel.
00043    *
00044    *  The area under the filter will be normalized to one.
00045    *
00046    *  The one dimesional kernel is calculated with the following equation:
00047    *
00048    *  \f$ g(n) = 1 - \frac{n}{| \lfloor size/2 \rfloor |} \f$
00049    *
00050    *  with
00051    *
00052    *  \f$ n = -\lceil size/2 \rceil  ~ \cdots ~ +(\lceil size/2 \rceil -1) \f$
00053    *
00054    *  Example:
00055    *
00056    *  \code
00057    *  // the vector to be filtered:
00058    *  lti::vector<channel::value_type> data;
00059    *
00060    *  // ... initialize vector here ...
00061    *
00062    *  // triangular filter kernel with 3 elements with n = -1,0,+1
00063    *  lti::triangularKernel1D<channel::value_type> aKernel(3);
00064    *
00065    *  // triangular filter kernel with 4 elements with n = -2,-1,0,+1
00066    *  lti::triangularKernel1D<channel::value_type> anotherKernel(4);
00067    *
00068    *  lti::convolution filter;                        // convolution operator
00069    *  lti::convolution::parameters param;             // parameters
00070    *  param.setKernel(aKernel);                       // use the triangular kernel
00071    *  filter.setParameters(param);                    // set parameters
00072    *
00073    *  // filter the vector and leave the result there too
00074    *
00075    *  filter.apply(data);
00076    *  \endcode
00077    */
00078   template<class T>
00079   class triangularKernel1D : public kernel1D<T> {
00080   public:
00081     /**
00082      * constructor
00083      * @param size size of the kernel in one dimension (default 5)
00084      */
00085     triangularKernel1D(const int& size = 5);
00086 
00087     /**
00088      * initialize this kernel with the specified value
00089      * @param size size of the kernel in one dimension
00090      */
00091     void generate(const int& size);
00092   };
00093 
00094 }
00095 
00096 #include "ltiTriangularKernels_template.h"
00097 
00098 #endif

Generated on Sat Apr 10 15:26:19 2010 for LTI-Lib by Doxygen 1.6.1