Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Gicp registration failed

Open mcmingchang opened this issue 1 year ago • 0 comments

Checklist

Describe the issue

I learned how to register Gicp from the source code and found the following two problems. BUG 1 :Gicp registration requires a normal vector or covariance. If only normal is provided, the result can be calculated, but if only covariance is provided, the calculation will fail.

BUG 2:In the function TransformationEstimationForGeneralizedICP:: ComputeTransformation, compute_jackian_1and_desidual const Eigen::Matrix3d M = Ct + Cs; const Eigen::Matrix3d W = M.inverse().sqrt(); Only after array() conversion can it be sqrt, and if there are negative numbers in the value of M.inverte(), the result will be nan.

This function will encounter errors during compilation. Does the gicp algorithm call other functions?

Steps to reproduce the bug

auto pcd = std::make_shared<open3d::geometry::PointCloud>();
auto pcd2 = std::make_shared<open3d::geometry::PointCloud>();
open3d::io::ReadPointCloud("1.ply", *pcd);
open3d::io::ReadPointCloud("1.ply", *pcd2);
float voxel_size = 6.5;
pcd = pcd->VoxelDownSample(voxel_size);
pcd2 = pcd2->VoxelDownSample(voxel_size);
//pcd->EstimateNormals(open3d::geometry::KDTreeSearchParamHybrid(voxel_size * 2, 30));
//pcd2->EstimateNormals(open3d::geometry::KDTreeSearchParamHybrid(voxel_size * 2, 30));
pcd->EstimateCovariances(open3d::geometry::KDTreeSearchParamHybrid(voxel_size * 2, 30));  // gicp error
pcd2->EstimateCovariances(open3d::geometry::KDTreeSearchParamHybrid(voxel_size * 2, 30));  // gicp error

auto R = pcd2->GetRotationMatrixFromXYZ(Eigen::Vector3d(0.2 * M_PI / 180.0, -0.2 * M_PI / 180.0, 0.2 * M_PI / 180.0));
pcd2->Rotate(R, pcd2->GetCenter());
pcd2->Translate(Eigen::Vector3d(10, 40, 5));



std::shared_ptr<open3d::pipelines::registration::RobustKernel> loss = std::make_shared<open3d::pipelines::registration::L2Loss>();
auto criteria = open3d::pipelines::registration::ICPConvergenceCriteria(0.01, 0.05, 100);
open3d::pipelines::registration::RegistrationResult result;
result = open3d::pipelines::registration::RegistrationGeneralizedICP(*pcd, *pcd2, voxel_size * 2, Eigen::Matrix4d::Identity(),
    open3d::pipelines::registration::TransformationEstimationForGeneralizedICP(0.001, loss), criteria);
cout << result.transformation_ << endl;

Error message

-nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind)

Expected behavior

No response

Open3D, Python and System information

- Operating system:  Windows 11 64-bit
- Python version: Python 3.11`
- Open3D version: output from python: `0.18.0`
- System architecture: x86
- Is this a remote workstation?:  no
- How did you install Open3D?: pip 
- Compiler version (if built from source): gcc 7.5 / clang 7.0

Additional information

No response

mcmingchang avatar Oct 15 '24 03:10 mcmingchang