20 #include <Eigen/Dense> 38 :
mean(init_Mean),
cov(init_Cov)
115 if (
this == &o)
return;
128 if (!f)
return false;
142 const CPose3D& newReferenceBase)
162 const auto C1 = p1.
cov;
163 const auto C2 = p2.
cov;
167 x1(0, 0) = p1.
mean.
x();
168 x1(1, 0) = p1.
mean.
y();
169 x1(2, 0) = p1.
mean.z();
170 x2(0, 0) = p2.
mean.
x();
171 x2(1, 0) = p2.
mean.
y();
172 x2(2, 0) = p2.
mean.z();
177 C2_inv.
asEigen() * x2.asEigen());
203 const Eigen::Vector3d MU(
207 exp(-0.5 * (MU.transpose() * C_inv.
asEigen() * MU)(0, 0));
233 (1.0 / std::sqrt(C.det())) *
234 exp(-0.5 * (MU.transpose() * C_inv.
asEigen() * MU)(0, 0));
268 outSample.
x(
mean.
x() + vec[0]);
269 outSample.
y(
mean.
y() + vec[1]);
270 outSample.z(
mean.z() + vec[2]);
280 [[maybe_unused]]
const double minMahalanobisDistToDrop)
303 deltaX(0, 2) = other.
mean.z() -
mean.z();
void copyFrom(const CPointPDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
A namespace of pseudo-random numbers generators of diferent distributions.
CMatrixFixed< Scalar, BLOCK_ROWS, BLOCK_COLS > blockCopy(int start_row=0, int start_col=0) const
const blockCopy(): Returns a copy of the given block
void getMean(CPoint3D &p) const override
CMatrixFixed< double, 1, 2 > CMatrixDouble12
This class is a "CSerializable" wrapper for "CMatrixDynamic<double>".
#define THROW_EXCEPTION(msg)
int void fclose(FILE *f)
An OS-independent version of fclose.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
CPoint3D mean
The mean value.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void changeCoordinatesReference(const CPose3D &newReferenceBase) override
this = p (+) this.
This file implements miscelaneous matrix and matrix/vector operations, and internal functions in mrpt...
MAT_C::Scalar multiply_HCHt_scalar(const VECTOR_H &H, const MAT_C &C)
r (scalar) = H*C*H^t (H: row vector, C: symmetric matrix)
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Virtual base class for "schematic archives" (JSON, XML,...)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define ASSERT_(f)
Defines an assertion mechanism.
void bayesianFusion(const CPointPDFGaussian &p1, const CPointPDFGaussian &p2)
Bayesian fusion of two points gauss.
CMatrixFixed< double, 3, 3 > CMatrixDouble33
This base provides a set of functions for maths stuff.
bool saveToTextFile(const std::string &file) const override
Save PDF's particles to a text file, containing the 2D pose in the first line, then the covariance ma...
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
double productIntegralNormalizedWith(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
auto block(int start_row, int start_col)
non-const block(): Returns an Eigen::Block reference to the block
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
double x() const
Common members of all points & poses classes.
Derived inverse_LLt() const
Returns the inverse of a symmetric matrix using LLt.
CMatrixDouble cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
CMatrixFixed< double, 2, 2 > CMatrixDouble22
A class used to store a 3D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods.
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
static constexpr size_t state_length
The length of the variable, for example, 3 for a 3D point, 6 for a 3D pose (x y z yaw pitch roll)...
return_t square(const num_t x)
Inline function for the square of a number.
This class is a "CSerializable" wrapper for "CMatrixFloat".
double productIntegralNormalizedWith2D(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
Virtual base class for "archives": classes abstracting I/O streams.
void drawGaussianMultivariate(std::vector< T > &out_result, const MATRIX &cov, const std::vector< T > *mean=nullptr)
Generate multidimensional random samples according to a given covariance matrix.
virtual std::tuple< cov_mat_t, type_value > getCovarianceAndMean() const =0
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
double mahalanobisDistanceTo(const CPointPDFGaussian &other, bool only_2D=false) const
Returns the Mahalanobis distance from this PDF to another PDF, that is, it's evaluation at (0...
This file implements matrix/vector text and binary serialization.
void readTo(CSerializable &obj)
double productIntegralWith(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
void drawSingleSample(CPoint3D &outSample) const override
Draw a sample from the pdf.
double mean(const CONTAINER &v)
Computes the mean value of a vector.
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object.
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods.
void getRotationMatrix(mrpt::math::CMatrixDouble33 &ROT) const
Get the 3x3 rotation matrix.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x...
CPointPDFGaussian()
Default constructor.
CMatrixFixed< double, ROWS, COLS > cast_double() const
double productIntegralWith2D(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
A gaussian distribution for 3D points.