Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Binomial.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef __Binomial_hh__
26 #define __Binomial_hh__
27 
28 #include "Convolution.hh"
29 
30 #define D_BINOMIAL_KERNEL 0x00010000
31 #define D_BINOMIAL_WRITE_IM 0x00020000
32 
33 namespace BIAS {
34  /**
35  * @class Binomial
36  * @test TestFilterBinomial.cpp
37  * @ingroup g_filter
38  * @brief binomial low pass filter class
39  * @author woelk 12/2004
40  */
41  template <class InputStorageType, class OutputStorageType>
42  class BIASFilter_EXPORT Binomial
43  : public Convolution<InputStorageType, OutputStorageType>
44  {
45 
46  public:
47  Binomial();
49  ~Binomial();
50 
51  /** @brief sets kernel if params changed and calls convolution */
52  virtual int Filter(const Image<InputStorageType>& src,
54 
55  /** @brief no implementation, calls Filter */
56  virtual int FilterFloat(const Image<InputStorageType>& src,
58 
59  /** @brief no implementation, calls Filter */
60  virtual int FilterInt(const Image<InputStorageType>& src,
62 
65 
66  /** @author woelk 12/2004 */
67  int Filter3x3(const Image<InputStorageType>& src,
69 
70  /** @author woelk 12/2004 */
71  int Filter5x5(const Image<InputStorageType>& src,
73 
74  /** @brief specialized function for convolution with 3x3 binomial filter.
75  dst must be initialized with the right image size. Internal calculation
76  is done using floating point numbers.
77  @author woelk 12/2004 */
78  int Filter3x3ValidGreyFloat(const Image<InputStorageType>& src,
80 
81  /** @brief specialized function for convolution with 5x5 binomial filter.
82  dst must be initialized with the right image size. Internal calculation
83  is done using floating point numbers.
84  @author woelk 12/2004 */
85  int Filter5x5ValidGreyFloat(const Image<InputStorageType>& src,
87 
88  /** @brief specialized function for convolution with 3x3 binomial filter.
89  dst must be initialized with the right image size. Internal calculation
90  is done using floating point numbers.
91  Uses "zero padding" of the image to achieve destination image ROIs
92  of same size as source image ROIs. Untested !!
93  @author woelk 07/2005 */
94  int Filter3x3SameGreyFloat(const Image<InputStorageType>& src,
96 
97 
98  //////////////////////////////////////////////////////////////////////
99 
100  inline int GetHalfWinSize() const
101  { return _HalfWinSize; }
102 
103  inline void SetHalfWinSize(int hws)
104  { _HalfWinSize = hws; }
105 
106  protected:
107  /// the parameter
110 
111  /// calculates the kernel
112  void _CalculateKernel(int HalfWinSize);
113 
114  virtual void GetBordersValid_(int &border_x, int &border_y) const;
115 
122 
123 
124  }; // class
125 
126 } // namespace
127 
128 
129 #endif // __Binomial_hh__
generic convolution class.
Definition: Convolution.hh:66
int _LastHalfWinSize
Definition: Binomial.hh:109
base class for simple n-&gt;n filter implementations
Definition: FilterNToN.hh:43
binomial low pass filter class
Definition: Binomial.hh:42
void SetHalfWinSize(int hws)
Definition: Binomial.hh:103
virtual FilterNToN< InputStorageType, OutputStorageType > * Clone() const
Definition: Binomial.hh:63
int _HalfWinSize
the parameter
Definition: Binomial.hh:108
int GetHalfWinSize() const
Definition: Binomial.hh:100