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 }
error_minimizer.h
PointMatcher::ErrorMinimizer::ErrorElements::nbRejectedPoints
int nbRejectedPoints
number of points with all matches set to zero weights
Definition: PointMatcher.h:541
Matches
PM::Matches Matches
Definition: pypoint_matcher_helper.h:19
PointMatcher::ErrorMinimizer::getCovariance
virtual Matrix getCovariance() const
If not redefined by child class, return zero matrix.
Definition: ErrorMinimizer.cpp:266
PointMatcher::ErrorMinimizer::getErrorElements
ErrorElements getErrorElements() const
Return the last the ErrorElements structure that was used for error minimization.
Definition: ErrorMinimizer.cpp:243
PointMatcher::ErrorMinimizer::ErrorElements::pointUsedRatio
T pointUsedRatio
the ratio of how many points were used for error minimization
Definition: PointMatcher.h:542
python::pointmatcher::pybindErrorMinimizer
void pybindErrorMinimizer(py::class_< PM > &p_class)
Definition: error_minimizer.cpp:7
PointMatcher::ErrorMinimizer::crossProduct
static Matrix crossProduct(const Matrix &A, const Matrix &B)
Helper funtion doing the cross product in 3D and a pseudo cross product in 2D.
Definition: ErrorMinimizer.cpp:282
PointMatcher::DataPoints
A point cloud.
Definition: PointMatcher.h:207
PointMatcher::ErrorMinimizer::getPointUsedRatio
T getPointUsedRatio() const
Return the ratio of how many points were used for error minimization.
Definition: ErrorMinimizer.cpp:236
PointMatcher::ErrorMinimizer::getResidualError
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.
Definition: ErrorMinimizer.cpp:274
PointMatcher::ErrorMinimizer::getOverlap
virtual T getOverlap() const
If not redefined by child class, return the ratio of how many points were used (with weight) for erro...
Definition: ErrorMinimizer.cpp:258
PointMatcher::ErrorMinimizer::getWeightedPointUsedRatio
T getWeightedPointUsedRatio() const
Return the ratio of how many points were used (with weight) for error minimization.
Definition: ErrorMinimizer.cpp:251
python
Definition: add_descriptor.cpp:5
OutlierWeights
PM::OutlierWeights OutlierWeights
Definition: pypoint_matcher_helper.h:64
PointMatcher::ErrorMinimizer::ErrorElements::matches
Matches matches
associations
Definition: PointMatcher.h:539
PointMatcher::ErrorMinimizer::ErrorElements::weightedPointUsedRatio
T weightedPointUsedRatio
the ratio of how many points were used (with weight) for error minimization
Definition: PointMatcher.h:543
PointMatcher::ErrorMinimizer::ErrorElements::reading
DataPoints reading
reading point cloud
Definition: PointMatcher.h:536
PointMatcher::ErrorMinimizer::ErrorElements::reference
DataPoints reference
reference point cloud
Definition: PointMatcher.h:537
PointMatcherSupport::Parametrizable
The superclass of classes that are constructed using generic parameters. This class provides the para...
Definition: Parametrizable.h:141
TransformationParameters
PM::TransformationParameters TransformationParameters
Definition: pypoint_matcher_helper.h:63
PointMatcher::ErrorMinimizer::ErrorElements::weights
OutlierWeights weights
weights for every association
Definition: PointMatcher.h:538
PointMatcher::ErrorMinimizer::ErrorElements::nbRejectedMatches
int nbRejectedMatches
number of matches with zero weights
Definition: PointMatcher.h:540
PointMatcher::ErrorMinimizer
An error minimizer will compute a transformation matrix such as to minimize the error between the rea...
Definition: PointMatcher.h:531
PointMatcher::ErrorMinimizer::compute
virtual TransformationParameters compute(const DataPoints &filteredReading, const DataPoints &filteredReference, const OutlierWeights &outlierWeights, const Matches &matches)
Find the transformation that minimizes the error.
Definition: ErrorMinimizer.cpp:218


libpointmatcher
Author(s):
autogenerated on Mon Sep 16 2024 02:24:08