mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 18:19:34 +08:00
demeaning with colwise expression
This commit is contained in:
parent
e3d08443dc
commit
99bb29abcf
@ -131,17 +131,11 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
|
|||||||
const VectorType dst_mean = dst.rowwise().sum() * one_over_n;
|
const VectorType dst_mean = dst.rowwise().sum() * one_over_n;
|
||||||
|
|
||||||
// demeaning of src and dst points
|
// demeaning of src and dst points
|
||||||
RowMajorMatrixType src_demean(m,n);
|
const RowMajorMatrixType src_demean = src.colwise() - src_mean;
|
||||||
RowMajorMatrixType dst_demean(m,n);
|
const RowMajorMatrixType dst_demean = dst.colwise() - dst_mean;
|
||||||
for (int i=0; i<n; ++i)
|
|
||||||
{
|
|
||||||
src_demean.col(i) = src.col(i) - src_mean;
|
|
||||||
dst_demean.col(i) = dst.col(i) - dst_mean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Eq. (36)-(37)
|
// Eq. (36)-(37)
|
||||||
const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n;
|
const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n;
|
||||||
// const Scalar dst_var = dst_demean.rowwise().squaredNorm().sum() * one_over_n;
|
|
||||||
|
|
||||||
// Eq. (38)
|
// Eq. (38)
|
||||||
const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose();
|
const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user