ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
NormalDistribution.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "GenericDistribution.h"
12 
13 namespace cloudViewer {
14 
16 
19 public:
22 
24 
29  NormalDistribution(ScalarType _mu, ScalarType _sigma2);
30 
31  // inherited methods (see GenericDistribution)
32  bool computeParameters(const ScalarContainer& values) override;
33  double computeP(ScalarType x) const override;
34  double computePfromZero(ScalarType x) const override;
35  double computeP(ScalarType x1, ScalarType x2) const override;
36  double computeChi2Dist(const GenericCloud* Yk,
37  unsigned numberOfClasses,
38  int* histo = nullptr) override;
39  const char* getName() const override { return "Gauss"; }
40 
42 
46  bool getParameters(ScalarType& _mu, ScalarType& _sigma2) const;
47 
49 
53  bool setParameters(ScalarType _mu, ScalarType _sigma2);
54 
56  inline ScalarType getMu() const { return m_mu; }
57 
59  inline ScalarType getSigma2() const { return m_sigma2; }
60 
63  bool computeParameters(const GenericCloud* cloud);
64 
67 
75  bool computeRobustParameters(const ScalarContainer& values, double nSigma);
76 
77 protected:
79 
83  virtual bool setChi2ClassesPositions(unsigned numberOfClasses);
84 
86  ScalarType m_mu;
88  ScalarType m_sigma2;
90  double m_qFactor;
92  double m_normFactor;
93 
95 
98  std::vector<ScalarType> m_chi2ClassesPositions;
99 
101  std::vector<ScalarType> m_Pi;
102 };
103 
104 } // namespace cloudViewer
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
A generic class to handle a probability distribution.
std::vector< ScalarType > ScalarContainer
Scalar values container.
The Normal/Gaussian statistical distribution.
double m_qFactor
Exponential quotient.
const char * getName() const override
Returns distribution name.
double m_normFactor
Normalization factor.
ScalarType getSigma2() const
Returns the distribution variance.
std::vector< ScalarType > m_chi2ClassesPositions
Chi2 classes limits.
std::vector< ScalarType > m_Pi
Structure used during the Chi2 distance computation.
ScalarType getMu() const
Returns the distribution mean.
Generic file read and write utility for python interface.