10 #ifndef EIGEN_UMEYAMA_H
11 #define EIGEN_UMEYAMA_H
21 #ifndef EIGEN_PARSED_BY_DOXYGEN
31 template<
typename MatrixType,
typename OtherMatrixType>
93 template <
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();
115 const RealScalar one_over_n = RealScalar(1) /
static_cast<RealScalar
>(n);
118 const VectorType src_mean = src.
rowwise().
sum() * one_over_n;
119 const VectorType dst_mean = dst.
rowwise().
sum() * one_over_n;
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);
137 VectorType S = VectorType::Ones(m);
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;
#define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a, b)
Definition: Macros.h:1294
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
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
const MatrixVType & matrixV() const
Definition: SVDBase.h:117
const SingularValuesType & singularValues() const
Definition: SVDBase.h:129
const MatrixUType & matrixU() const
Definition: SVDBase.h:101
EIGEN_DEVICE_FUNC const SumReturnType sum() const
Definition: VectorwiseOp.h:479
EIGEN_DEVICE_FUNC const SquaredNormReturnType squaredNorm() const
Definition: VectorwiseOp.h:410
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: LDLT.h:16
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: document.h:416
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1282
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
Definition: ForwardDeclarations.h:17