10#ifndef EIGEN_UMEYAMA_H
11#define EIGEN_UMEYAMA_H
21#ifndef EIGEN_PARSED_BY_DOXYGEN
31template<
typename MatrixType,
typename OtherMatrixType>
93template <
typename Derived,
typename OtherDerived>
103 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
111 const Index m = src.rows();
112 const Index n = src.cols();
122 const RowMajorMatrixType src_demean = src.
colwise() - src_mean;
123 const RowMajorMatrixType dst_demean = dst.
colwise() - dst_mean;
126 const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n;
129 const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose();
134 TransformationMatrixType Rt = TransformationMatrixType::Identity(
m+1,
m+1);
139 if (
svd.matrixU().determinant() *
svd.matrixV().determinant() < 0 )
143 Rt.block(0,0,
m,
m).noalias() =
svd.matrixU() * S.asDiagonal() *
svd.matrixV().transpose();
151 Rt.col(
m).head(
m) = dst_mean;
152 Rt.col(
m).head(
m).noalias() -=
c*Rt.topLeftCorner(
m,
m)*src_mean;
153 Rt.block(0,0,
m,
m) *=
c;
157 Rt.col(
m).head(
m) = dst_mean;
158 Rt.col(
m).head(
m).noalias() -= Rt.topLeftCorner(
m,
m)*src_mean;
Matrix3f m
Definition AngleAxis_mimic_euler.cpp:1
int n
Definition BiCGSTAB_simple.cpp:1
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf > svd(m, ComputeThinU|ComputeThinV)
#define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a, b)
Definition Macros.h:1294
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:127
Scalar Scalar * c
Definition benchVecAdd.cpp:17
SCALAR Scalar
Definition bench_gemm.cpp:46
NumTraits< Scalar >::Real RealScalar
Definition bench_gemm.cpp:47
MatrixXf MatrixType
Definition benchmark-blocking-sizes.cpp:52
EIGEN_DEVICE_FUNC ConstColwiseReturnType colwise() const
Definition DenseBase.h:562
EIGEN_DEVICE_FUNC ConstRowwiseReturnType rowwise() const
Definition DenseBase.h:550
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition JacobiSVD.h:490
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
EIGEN_DEVICE_FUNC const SumReturnType sum() const
Definition VectorwiseOp.h:479
internal::umeyama_transform_matrix_type< Derived, OtherDerived >::type umeyama(const MatrixBase< Derived > &src, const MatrixBase< OtherDerived > &dst, bool with_scaling=true)
Returns the transformation between two point sets.
Definition Umeyama.h:95
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
@ AutoAlign
Definition Constants.h:323
@ ComputeFullV
Definition Constants.h:397
@ ComputeFullU
Definition Constants.h:393
const unsigned int RowMajorBit
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
Definition Constants.h:22
Definition BandTriangularSolver.h:13
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Definition ForwardDeclarations.h:17