Clear Filters
Clear Filters

Why am I getting an unexpected output using pcregistericp?

15 views (last 30 days)
Hello,
I am hoping to use the function pcregistericp in my research, so I created a simple test to try to understand the code better. I created two sets of points, one rotating 45deg counterclockwise relative to the first set of points. However, the output point cloud only translates instead of rotates, which shouldn't be correct.
Are you able to look at my code to see if I'm using pcregistericp incorrectly? Or is this just a limitation of using the iterative closest point algorithm? Thank you very much for your help. The code is inserted below:
% Moving
m1 = [ 1 , 0 , 0 ; 0 , 1 , 0 ; -1 , 0 , 0 ; 0 , -1 , 0 ; 0 , 0 , 0 ] ;
% Fixed
f1 = [ cosd(45) , sind(45) , 0 ; cosd(135) , sind(135) , 0 ; cosd(225) , sind(225) , 0 ; cosd(315) , sind(315) , 0 ; 0 , 0 , 0 ] ;
% Use pcregistericp after converting to point clouds
[ Tform , mNew , rmse ] = pcregistericp( pointCloud( m1 ) , pointCloud( f1 ) ) ;
% Plot point cloud locations
figure() ; hold on ; title( [ 'RMSE = ' , num2str(rmse) ] )
scatter3( m1(:,1) , m1(:,2) , m1(:,3) , 'r' , 'filled' )
scatter3( f1(:,1) , f1(:,2) , f1(:,3) , 'b' , 'filled' )
scatter3( mNew.Location(:,1) , mNew.Location(:,2) , mNew.Location(:,3) , 'g' )
legend( 'Moving' , 'Fixed' , 'New moving' )
  1 Comment
Matthew Blomquist
Matthew Blomquist on 25 May 2023
UPDATE: I wanted to follow up in case anyone comes across this in the future. I did some more digging on ICP code created on MATLAB file exchange and found that most of the limitations arise when the rotations and/or translations are very large, then the algorithm cannot solve well. So, using the code above, I changed the angles to be 44.9, 90+44.9, etc. and found that the algorithm worked perfectly. So, it seems like 45deg is too large of a rotation for this problem.
For my research, my plan is to try to align the two point clouds manually, and then use pcregistericp to fine tune the registration. Then the translations and rotations should be small enough for the algorithm to work. I'm happy to hear other suggestions, though!

Sign in to comment.

Accepted Answer

Karan Singh
Karan Singh on 29 Aug 2023
Hey Matthew, upon reviewing your code, it seems that you are using the “pcregistericp” function correctly. However, the behaviour you are observing is expected when using the iterative closest point (ICP) algorithm.
The ICP algorithm is primarily designed to estimate translations and rotations between two-point clouds. It assumes that the two-point clouds have a similar shape and differ only by translation and rotation. In your case, the two-point clouds have a different shape (one is a rotation of the other), which is not an ideal scenario for ICP.
Although as you have updated you have found the answer for it yourself only, I hope the explanation above serves as a suggestion reaffirming the same.
Hope it helps!

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!