DGtal 1.3.0
Loading...
Searching...
No Matches
BasicConvolutionWeights.h
1
17#pragma once
18
31#if defined(BasicConvolutionWeights_RECURSES)
32#error Recursive header files inclusion detected in BasicConvolutionWeights.h
33#else // defined(BasicConvolutionWeights_RECURSES)
35#define BasicConvolutionWeights_RECURSES
36
37#if !defined BasicConvolutionWeights_h
39#define BasicConvolutionWeights_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
45#include "DGtal/kernel/NumberTraits.h"
47
48namespace DGtal
49{
50 namespace deprecated
51 {
53 // template class ConstantConvolutionWeight
66 template <typename TDistance>
68 {
69 // ----------------------- Standard services ------------------------------
70 public:
71
73 typedef TDistance Distance;
74
75
79 inline
80 double operator()(const Distance &/*aDisplacement*/) const
81 {
82 return 1.0;
83 }
84 };
85
87 // template class ConstantConvolutionWeight
98 template <typename TDistance>
100 {
101 // ----------------------- Standard services ------------------------------
102 public:
103
105 typedef TDistance Distance;
106
112 GaussianConvolutionWeights(const double sigma): mySigma(sigma)
113 {
114 myCoef = 1.0/(mySigma * sqrt(2.0*M_PI));
115 myCoef2 = 1.0/(2.0*M_PI);
116 }
117
125 inline
126 double operator()(const Distance &aDisplacment) const
127 {
128 return myCoef*exp(-NumberTraits<Distance>::castToDouble(aDisplacment)*
130 }
131
133 double mySigma;
134
136 double myCoef;
137 double myCoef2;
138 };
139
140 }
141
142
143} // namespace DGtal
144
146
147#endif // !defined BasicConvolutionWeights_h
148
149#undef BasicConvolutionWeights_RECURSES
150#endif // else defined(BasicConvolutionWeights_RECURSES)
Aim: implement a trivial constant convolution kernel which returns 1 to each distance.
Aim: implement a Gaussian centered convolution kernel.
TDistance Distance
Inner type for the topological distance.
double operator()(const Distance &aDisplacment) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:564