Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Bilateral.hh
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003, 2004 (see file CONTACTS for details)
4  Multimediale Systeme der Informationsverarbeitung
5  Institut fuer Informatik
6  Christian-Albrechts-Universitaet Kiel
7 
8  BIAS is free software; you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation; either version 2.1 of the License, or
11  (at your option) any later version.
12 
13  BIAS is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with BIAS; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
21 #ifndef __Bilateral_hh__
22 #define __Bilateral_hh__
23 
24 #include <Base/Image/Image.hh>
25 #include <Filter/FilterNToN.hh>
26 
27 namespace BIAS {
28 
29  /** @class Bilateral
30  @ingroup g_filter
31  @brief 2D bilateral filter
32  @author ischiller
33  */
34  template <class InputStorageType, class OutputStorageType>
35  class BIASFilter_EXPORT Bilateral
36  : public FilterNToN<InputStorageType, OutputStorageType>
37  {
38  public:
39  Bilateral();
40 
42 
43  virtual ~Bilateral();
44 
45  /** @brief Bilateral filtering with given filter size (5x5 as standard) */
46  virtual int Filter(const Image<InputStorageType>& src,
48 
49  /** @brief Bilateral filtering with given filter size (5x5 as standard)
50  uses support image as smoothing restriction, see
51  Petschnigg 2004: DigitalPhotography
52  */
53  virtual int Filter(const Image<InputStorageType>& src,
54  const Image<InputStorageType>& support,
56 
57  virtual int FilterInt(const Image<InputStorageType>& src,
59 
60  virtual int FilterFloat(const Image<InputStorageType>& src,
62 
65 
66  /**
67  @brief Filter a color image by calling Filter(...) for every channel
68  */
69  int FilterColorImg(const Image<InputStorageType>& src,
71 
72  /**
73  @brief Filter a color image with support image by calling Filter(...)
74  for every channel
75  */
76  int FilterColorImg(const Image<InputStorageType>& src,
77  const Image<InputStorageType>& support,
79 
80 
81  void SetSize(int newsize, int secondsize=-1);
82 
83  inline void SetSigma(const double si) { _CalculateKernels(si); }
84  inline double GetSigma() const { return _GaussSigma; }
85  inline void SetBilateralSigma(const double si) { _BilateralSigma=si;}
86  inline double GetBilateralSigma() const { return _BilateralSigma; }
87  inline void SetIgnoreValue(InputStorageType ignore){_ignoreValue = ignore;};
88  inline InputStorageType GetIgnoreValue(){return _ignoreValue;};
89 
90  protected:
91  void _CalculateKernels(double gaussSigma);
92 
93  protected:
94  /// sigma of gaussian kernel
95  double _GaussSigma, _BilateralSigma;
96  /// half win size of filter, 1 means 3x3
97  int _BilateralSize, _lastBilateralSize;
98  /// Use this variable for non-quadratic filter sizes e.g. 3x1
99  int _secondSize,_lastSecondSize;
100 
102 
103  InputStorageType _ignoreValue;
104 
105  virtual void GetBordersValid_(int &border_x, int &border_y) const;
106  };
107 }// namepspace
108 
109 
110 
111 
112 #endif // __Bilateral_hh__
int _lastBilateralSize
Definition: Bilateral.hh:97
double _GaussSigma
sigma of gaussian kernel
Definition: Bilateral.hh:95
int _secondSize
Use this variable for non-quadratic filter sizes e.g. 3x1.
Definition: Bilateral.hh:99
void SetSigma(const double si)
Definition: Bilateral.hh:83
InputStorageType _ignoreValue
Definition: Bilateral.hh:103
base class for simple n-&gt;n filter implementations
Definition: FilterNToN.hh:43
2D bilateral filter
Definition: Bilateral.hh:35
double GetSigma() const
Definition: Bilateral.hh:84
void SetIgnoreValue(InputStorageType ignore)
Definition: Bilateral.hh:87
void SetBilateralSigma(const double si)
Definition: Bilateral.hh:85
InputStorageType GetIgnoreValue()
Definition: Bilateral.hh:88
double GetBilateralSigma() const
Definition: Bilateral.hh:86
BIAS::Image< float > _gaussFilterMask
Definition: Bilateral.hh:101
virtual FilterNToN< InputStorageType, OutputStorageType > * Clone() const
Definition: Bilateral.hh:63