koide3 / small_gicp

Efficient and parallel algorithms for point cloud registration [C++, Python]
MIT License
318 stars 40 forks source link

Question about CovarianceSetter #73

Closed Wuqiqi123 closed 1 month ago

Wuqiqi123 commented 1 month ago
template <typename PointCloud>
struct CovarianceSetter {
  /// @brief Handle invalid case (too few points).
  static void set_invalid(PointCloud& cloud, size_t i) {
    Eigen::Matrix4d cov = Eigen::Matrix4d::Identity();
    cov(3, 3) = 0.0;
    traits::set_cov(cloud, i, cov);
  }

  /// @brief Compute and set the covariance to the point cloud.
  static void set(PointCloud& cloud, size_t i, const Eigen::Matrix3d& eigenvectors) {
    const Eigen::Vector3d values(1e-3, 1.0, 1.0);
    Eigen::Matrix4d cov = Eigen::Matrix4d::Zero();
    cov.block<3, 3>(0, 0) = eigenvectors * values.asDiagonal() * eigenvectors.transpose();
    traits::set_cov(cloud, i, cov);
  }
};

Thank you for your work. I have question of why values is (1e-3, 1.0, 1.0), what's the meaning of 1e-3. @koide3

koide3 commented 1 month ago

It is eigenvalues to regularize a covariance matrix as a plane and avoid degeneration. Please see Sec. III. B in Generalized ICP for details.