Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

icp_registration

Open coolinfan20 opened this issue 7 years ago • 9 comments

Hi, I am fairly new to point clouds and had a questions about using the icp_registration and global_registration codes to align customized point clouds. When I import my own pcd files, I get the the following error message:

Error: TransformationEstimationPointToPlane requires pre-computed normal vectors. RegistrationResult with fitness = 0.000000, inlier_rmse = 0.000000, and correspondence_set size of 0 Access transformation to get result. Transformation is: [[ 0.862 0.011 -0.507 0.5 ] [-0.139 0.967 -0.215 0.7 ] [ 0.487 0.255 0.835 -1.4 ] [ 0. 0. 0. 1. ]]

Could you explain how I calculate the pre-computed normal vectors? I tried importing the global_registration code to get the normals since the documentation says that the global registration is used to initialize the local methods?

Thanks!

coolinfan20 avatar Feb 07 '19 16:02 coolinfan20

Hi @coolinfan20. Please read this tutorial. In short, Point-to-Plane ICP requires vertex normal, so you need to compute vertex normal before using point-to-plane ICP.

This is duplicate of #468.

syncle avatar Feb 07 '19 20:02 syncle

I used the estimate_normals to get a vector of normals for my source and target point clouds using the following code:

estimate_normals(downsource, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30)) estimate_normals(downtarget, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30))

reg_p2l = registration_icp(source, target, threshold, trans_init, TransformationEstimationPointToPlane(np.asarray(downsource.normals)[:,:]))

but end up with this error message: TransformationEstimationPointToPlane(np.asarray(downsource.normals)[:,:])) TypeError: init(): incompatible constructor arguments. The following argument types are supported: 1. open3d.open3d.registration.TransformationEstimationPointToPlane() 2. open3d.open3d.registration.TransformationEstimationPointToPlane(arg0: open3d.open3d.registration.TransformationEstimationPointToPlane)

What is the correct syntax for TransformationEstimationPointToPlane? Also, do I need to pass it the normal vectors for both the source and the target?

coolinfan20 avatar Feb 11 '19 16:02 coolinfan20

estimate_normals is inplace function - this means that you will have vertex normal inside downsource and downtarget. You don't have to explicitly pass normals. Just try

estimate_normals(downsource, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30))
estimate_normals(downtarget, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30))
reg_p2l = registration_icp(downsource, downtarget, threshold, trans_init, TransformationEstimationPointToPlane())

syncle avatar Feb 11 '19 18:02 syncle

initial transformation

Now that I've calculated the normals vectors, I am able to execute the registration_icp function, but I still am unable to get my two point clouds to align properly. I have tried changing the voxel_size and adding the ICP convergence criteria to try to get it to iterate more times, but the point clouds either don't change or do not fully align. The images I have included are the initial point cloud poses and the final poses, respectively.

Thanks!

coolinfan20 avatar Feb 11 '19 22:02 coolinfan20

Point cloud registration method is not guaranteed to align any point clouds - see the previous discussions in #359.

syncle avatar Feb 12 '19 22:02 syncle

Regarding your previous comment, I thought the purpose of point cloud registration was to align two point clouds?

However, it seems that by voxelizing the point clouds, I was able to get it to register some of the point clouds. I was playing around with the voxel size and found that even with the same set of point clouds and voxel sizes, the fitness, inlier_rmse, and correspondence sizes will vary. Do you know why this is?

coolinfan20 avatar Feb 19 '19 21:02 coolinfan20

I also had a few more questions regarding the RMSE error: I added the ICPConvergenceCriteria the registration_icp of your Global Registration code because I wanted the transformation that would minimize the RMSE, so I changed the parameter to relative_rmse instead of max_iteration (from the ICP registration demo code); however, the inlier_rmse continues to fluctuate and often times is nowhere close to the relative_rmse parameter I set.

So I am wondering what the difference is between inlier_rmse and relative_rmse? What would make the inlier_rmse more consistent?

Also, I am assuming the correspondence_set size is how many points between the points clouds are aligned? If this is correct, I am also wondering why this value will have significant fluctuations (sometimes more than 500 for a downsized point cloud containing only ~4000 points) even though the transformation is relatively the same?

Thanks!

coolinfan20 avatar Feb 19 '19 22:02 coolinfan20

Utilicé el estimativo_normals para obtener un vector de normales para mis nubes de puntos de origen y destino usando el siguiente código:

estimate_normals(downsource, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30)) estimate_normals(downtarget, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30))

reg_p2l = registration_icp(source, target, threshold, trans_init, TransformationEstimationPointToPlane(np.asarray(downsource.normals)[:,:]))

pero termina con este mensaje de error: TransformationEstimationPointToPlane (np.asarray (downsource.normals) [:,:])) TypeError: init (): argumentos de constructor incompatibles. Se admiten los siguientes tipos de argumentos:

  1. open3d.open3d.registration.TransformationEstimationPointToPlane ()
  2. open3d.open3d.registration.TransformationEstimationPointToPlane (arg0: open3d.open3d.registration.TransformationEstimationPointToPlane)

¿Cuál es la sintaxis correcta para TransformationEstimationPointToPlane? Además, ¿debo pasarle los vectores normales tanto para el origen como para el destino?

I used the estimate_normals to get a vector of normals for my source and target point clouds using the following code:

estimate_normals(downsource, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30)) estimate_normals(downtarget, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30))

reg_p2l = registration_icp(source, target, threshold, trans_init, TransformationEstimationPointToPlane(np.asarray(downsource.normals)[:,:]))

but end up with this error message: TransformationEstimationPointToPlane(np.asarray(downsource.normals)[:,:])) TypeError: init(): incompatible constructor arguments. The following argument types are supported:

  1. open3d.open3d.registration.TransformationEstimationPointToPlane()
  2. open3d.open3d.registration.TransformationEstimationPointToPlane(arg0: open3d.open3d.registration.TransformationEstimationPointToPlane)

What is the correct syntax for TransformationEstimationPointToPlane? Also, do I need to pass it the normal vectors for both the source and the target?

Did you fix this problem? How did you define estimate_normals in the algorithm? I put this part of the code in the main and I get the following error:

[Open3D WARNING] TransformationEstimationPointToPlane requires pre-computed normal vectors. registration::RegistrationResult with fitness = 0.000000, inlier_rmse = 0.000000, and correspondence_set size of 0 Access transformation to get result. Traceback (most recent call last): File "global_registration.py", line 104, in estimate_normals(source, search_param = KDTreeSearchParamHybrid( radius = 0.1, max_nn = 30)) NameError: name 'estimate_normals' is not defined

Could you help me ?

edwincasallas22 avatar Oct 17 '19 20:10 edwincasallas22

Issue closed due to lack of activity. Feel free to open a new issue if you still consider this is a critical matter.

germanros1987 avatar Jul 27 '20 23:07 germanros1987