Ignition Rendering

API Reference

5.0.0
BaseGaussianNoisePass.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef IGNITION_RENDERING_BASE_BASEGAUSSIANNOISEPASS_HH_
18 #define IGNITION_RENDERING_BASE_BASEGAUSSIANNOISEPASS_HH_
19 
20 #include <string>
21 #include <ignition/math/Rand.hh>
22 
24 
25 namespace ignition
26 {
27  namespace rendering
28  {
29  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
30  //
31  /* \class BaseGaussianNoisePass BaseGaussianNoisePass.hh \
32  * ignition/rendering/base/BaseGaussianNoisePass.hh
33  */
35  template <class T>
37  public virtual GaussianNoisePass,
38  public virtual T
39  {
41  protected: BaseGaussianNoisePass();
42 
44  public: virtual ~BaseGaussianNoisePass();
45 
46  // Documentation inherited.
47  public: double Mean() const;
48 
49  // Documentation inherited.
50  public: double StdDev() const;
51 
52  // Documentation inherited.
53  public: double Bias() const;
54 
55  // Documentation inherited.
56  public: void SetMean(double _mean);
57 
58  // Documentation inherited.
59  public: void SetStdDev(double _stdDev);
60 
61  // Documentation inherited.
62  public: void SetBiasMean(double _biasMean);
63 
64  // Documentation inherited.
65  public: void SetBiasStdDev(double _biasStdDev);
66 
67  // Sample the bias from bias mean and bias standard deviation
68  protected: void SampleBias();
69 
71  protected: double mean = 0.0;
72 
74  protected: double stdDev = 0.0;
75 
77  protected: double bias = 0.0;
78 
81  protected: double biasMean = 0;
82 
85  protected: double biasStdDev = 0;
86  };
87 
89  // BaseGaussianNoisePass
91  template <class T>
93  {
94  }
95 
97  template <class T>
99  {
100  }
101 
103  template <class T>
105  {
106  return this->mean;
107  }
108 
110  template <class T>
112  {
113  return this->stdDev;
114  }
115 
117  template <class T>
119  {
120  return this->bias;
121  }
122 
124  template <class T>
126  {
127  this->mean = _mean;
128  }
129 
131  template <class T>
133  {
134  this->stdDev = _stdDev;
135  }
136 
138  template <class T>
140  {
141  this->biasMean = _biasMean;
142  this->SampleBias();
143  }
144 
146  template <class T>
148  {
149  this->biasStdDev = _biasStdDev;
150  this->SampleBias();
151  }
152 
154  template <class T>
156  {
157  this->bias =
158  ignition::math::Rand::DblNormal(this->biasMean, this->biasStdDev);
159  // With equal probability, we pick a negative bias (by convention,
160  // rateBiasMean should be positive, though it would work fine if
161  // negative).
163  this->bias = -this->bias;
164  }
165  }
166  }
167 }
168 #endif
void SetBiasStdDev(double _biasStdDev)
Set the standard deviation of the bias value. Bias is computed based on the bias mean and bias standa...
Definition: BaseGaussianNoisePass.hh:147
virtual ~BaseGaussianNoisePass()
Destructor.
Definition: BaseGaussianNoisePass.hh:98
T mean(const std::vector< T > &_values)
double Bias() const
Accessor for bias.
Definition: BaseGaussianNoisePass.hh:118
A render pass that applies Gaussian noise to the render target.
Definition: GaussianNoisePass.hh:35
void SetBiasMean(double _biasMean)
Set the mean of the bias value. Bias is computed based on the bias mean and bias standard deviation...
Definition: BaseGaussianNoisePass.hh:139
double StdDev() const
Accessor for stddev.
Definition: BaseGaussianNoisePass.hh:111
void SetStdDev(double _stdDev)
Set stddev.
Definition: BaseGaussianNoisePass.hh:132
Base Gaussian noise render pass.
Definition: BaseGaussianNoisePass.hh:36
BaseGaussianNoisePass()
Constructor.
Definition: BaseGaussianNoisePass.hh:92
void SampleBias()
Definition: BaseGaussianNoisePass.hh:155
static double DblUniform(double _min=0, double _max=1)
static double DblNormal(double _mean=0, double _sigma=1)
double Mean() const
Accessor for mean.
Definition: BaseGaussianNoisePass.hh:104
void SetMean(double _mean)
Set mean.
Definition: BaseGaussianNoisePass.hh:125