40 using namespace Eigen;
58 return compute_in_place(mPts);
68 const T w_sum_inv =
T(1.)/w.sum();
70 (mPts.
reading.
features.topRows(dimCount-1).array().rowwise() * w.array().transpose()).rowwise().sum() * w_sum_inv;
71 const Vector meanReference =
72 (mPts.
reference.
features.topRows(dimCount-1).array().rowwise() * w.array().transpose()).rowwise().sum() * w_sum_inv;
82 const JacobiSVD<Matrix> svd(m, ComputeThinU | ComputeThinV);
83 Matrix rotMatrix(svd.matrixU() * svd.matrixV().transpose());
88 if (rotMatrix.determinant() < 0.)
90 Matrix tmpV = svd.matrixV().transpose();
91 tmpV.row(dimCount-2) *= -1.;
92 rotMatrix = svd.matrixU() * tmpV;
94 const Vector trVector(meanReference - rotMatrix * meanReading);
96 Matrix result(Matrix::Identity(dimCount, dimCount));
97 result.topLeftCorner(dimCount-1, dimCount-1) = rotMatrix;
98 result.topRightCorner(dimCount-1, 1) = trVector;
110 assert(
matches.ids.rows() > 0);
124 const int nbPoints = this->lastErrorElements.reading.features.cols();
125 const int dim = this->lastErrorElements.reading.features.rows();
128 throw std::runtime_error(
"Error, last error element empty. Error minimizer needs to be called at least once before using this method.");
131 if (!this->lastErrorElements.reading.descriptorExists(
"simpleSensorNoise"))
133 LOG_INFO_STREAM(
"PointToPointErrorMinimizer - warning, no sensor noise found. Using best estimate given outlier rejection instead.");
134 return this->getWeightedPointUsedRatio();
137 const BOOST_AUTO(noises, this->lastErrorElements.reading.getDescriptorViewByName(
"simpleSensorNoise"));
139 const Vector dists = (this->lastErrorElements.reading.features.topRows(
dim-1) - this->lastErrorElements.reference.features.topRows(
dim-1)).colwise().norm();
140 const T mean = dists.sum()/nbPoints;
143 for(
int i=0; i < nbPoints; i++)
145 if(dists(i) < (mean + noises(0,i)))
151 return (
T)count/(
T)nbPoints;
162 Matrix deltaNorms = deltas.colwise().norm();
163 return deltaNorms.sum();