error_minimizer.cpp
Go to the documentation of this file.
1 #include "error_minimizer.h"
2 
3 namespace python
4 {
5  namespace pointmatcher
6  {
7  void pybindErrorMinimizer(py::class_<PM>& p_class)
8  {
9  py::class_<ErrorMinimizer, std::shared_ptr<ErrorMinimizer>, Parametrizable> pyErrorMinimizer(p_class, "ErrorMinimizer");
10 
11  pyErrorMinimizer.doc() = R"pbdoc(
12 An error minimizer will compute a transformation matrix such as to minimize the error between the reading and the reference.
13 
14 Typical error minimized are point-to-point and point-to-plane.
15 )pbdoc";
16 
17  py::class_<ErrorElements>(pyErrorMinimizer, "ErrorElements", "A structure holding data ready for minimization. The data are \"normalized\", for instance there are no points with 0 weight, etc.")
18  .def_readwrite("reading", &ErrorElements::reading, "reading point cloud")
19  .def_readwrite("reference", &ErrorElements::reference, "reference point cloud")
20  .def_readwrite("weights", &ErrorElements::weights, "weights for every association")
21  .def_readwrite("matches", &ErrorElements::matches, "associations")
22  .def_readwrite("nbRejectedMatches", &ErrorElements::nbRejectedMatches, "number of matches with zero weights")
23  .def_readwrite("nbRejectedPoints", &ErrorElements::nbRejectedPoints, "number of points with all matches set to zero weights")
24  .def_readwrite("pointUsedRatio", &ErrorElements::pointUsedRatio, "the ratio of how many points were used for error minimization")
25  .def_readwrite("weightedPointUsedRatio", &ErrorElements::weightedPointUsedRatio, "the ratio of how many points were used (with weight) for error minimization")
26 
27  .def(py::init<>())
28  .def(py::init<const DataPoints&, const DataPoints&, const OutlierWeights&, const Matches&>(), py::arg("requestedPts"), py::arg("sourcePts"), py::arg("outlierWeights"), py::arg("matches"));
29 
30  pyErrorMinimizer.def("getPointUsedRatio", &ErrorMinimizer::getPointUsedRatio)
31  .def("getWeightedPointUsedRatio", &ErrorMinimizer::getWeightedPointUsedRatio)
32  .def("getErrorElements", &ErrorMinimizer::getErrorElements)
33  .def("getOverlap", &ErrorMinimizer::getOverlap).def("getCovariance", &ErrorMinimizer::getCovariance)
34  .def("getResidualError", &ErrorMinimizer::getResidualError, py::arg("filteredReading"), py::arg("filteredReference"), py::arg("outlierWeights"), py::arg("matches"))
35  .def("compute", (TransformationParameters (ErrorMinimizer::*)(const DataPoints&, const DataPoints&, const OutlierWeights&, const Matches&)) &ErrorMinimizer::compute, py::arg("filteredReading"), py::arg("filteredReference"), py::arg("outlierWeights"), py::arg("matches"))
36  .def_static("crossProduct", &ErrorMinimizer::crossProduct, py::arg("A"), py::arg("B"));
37 
38  }
39  }
40 }
static Matrix crossProduct(const Matrix &A, const Matrix &B)
Helper funtion doing the cross product in 3D and a pseudo cross product in 2D.
T getPointUsedRatio() const
Return the ratio of how many points were used for error minimization.
PM::OutlierWeights OutlierWeights
virtual T getResidualError(const DataPoints &filteredReading, const DataPoints &filteredReference, const OutlierWeights &outlierWeights, const Matches &matches) const
If not redefined by child class, return max value for T.
virtual T getOverlap() const
If not redefined by child class, return the ratio of how many points were used (with weight) for erro...
T weightedPointUsedRatio
the ratio of how many points were used (with weight) for error minimization
Definition: PointMatcher.h:542
DataPoints reference
reference point cloud
Definition: PointMatcher.h:536
An error minimizer will compute a transformation matrix such as to minimize the error between the rea...
Definition: PointMatcher.h:530
ErrorElements getErrorElements() const
Return the last the ErrorElements structure that was used for error minimization. ...
int nbRejectedPoints
number of points with all matches set to zero weights
Definition: PointMatcher.h:540
T getWeightedPointUsedRatio() const
Return the ratio of how many points were used (with weight) for error minimization.
OutlierWeights weights
weights for every association
Definition: PointMatcher.h:537
int nbRejectedMatches
number of matches with zero weights
Definition: PointMatcher.h:539
virtual TransformationParameters compute(const DataPoints &filteredReading, const DataPoints &filteredReference, const OutlierWeights &outlierWeights, const Matches &matches)
Find the transformation that minimizes the error.
The superclass of classes that are constructed using generic parameters. This class provides the para...
virtual Matrix getCovariance() const
If not redefined by child class, return zero matrix.
void pybindErrorMinimizer(py::class_< PM > &p_class)
T pointUsedRatio
the ratio of how many points were used for error minimization
Definition: PointMatcher.h:541
PM::TransformationParameters TransformationParameters
PM::Matches Matches
DataPoints reading
reading point cloud
Definition: PointMatcher.h:535


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:36:30