pglira / simpleICP

Implementations of a rather simple version of the Iterative Closest Point algorithm in various languages.
MIT License
299 stars 60 forks source link

Not having the correct transformation Matrix #34

Open MeerssemanBastien opened 1 year ago

MeerssemanBastien commented 1 year ago

Hi, Im trying to use your code for point cloud of small point (about 10 -20 points per pointscloud ) in order to test that i use a .xyz containing 20 points of the the 20 vertices of a dodecahedron (fixed point cloud). i created a second files of this one where i moved each X coordinate by ading +10 (movable point cloud) . Im feeding the algorithm with this two files and the algorithm give me back this matrix : H = [ 0.930487 0.366326 0.000000 -9.831626] [ -0.366326 0.930487 0.000000 0.130998] [ -0.000000 -0.000000 1.000000 0.000000] [ 0.000000 0.000000 0.000000 1.000000] i saw on the README file that to move a point to the position of the fixed, i have to do this operation to get the movable point tof fit the fixed point ; Xt = H*X im doing so : X =[ 10.57735027; 0.57735027 ;0.57735027 ; 1] coordinate of first point in the movable point cloud H = [ 0.930487 0.366326 0.000000 -9.831626] [ -0.366326 0.930487 0.000000 0.130998] [ -0.000000 -0.000000 1.000000 0.000000] [ 0.000000 0.000000 0.000000 1.000000]

but when i'm trying it, im not recovering the correct point : Xt=X*A Xt=[0.2220 -3.2065 0.5774 1.0000]

and if i understand well i should get the coordinate of this : xt =0.57735027 0.57735027 0.57735027 1 wich is the coordinate of the first point in the fixed point cloud

so im asking myself if the algorithm is working properly . or im not using it correctly

here is the two points cloud and some screenshot . dode1.xyz (fixed pointcloud) : 0.57735027 0.57735027 0.57735027 0.57735027 0.57735027 -0.57735027 0.57735027 -0.57735027 0.57735027 0.57735027 -0.57735027 -0.57735027 -0.57735027 0.57735027 0.57735027 -0.57735027 0.57735027 -0.57735027 -0.57735027 -0.57735027 0.57735027 -0.57735027 -0.57735027 -0.57735027 0.35682209 0.93417236 0.00000000 -0.35682209 0.93417236 0.00000000 0.35682209 -0.93417236 0.00000000 -0.35682209 -0.93417236 0.00000000 0.93417236 0.00000000 0.35682209 0.93417236 0.00000000 -0.35682209 -0.93417236 0.00000000 0.35682209 -0.93417236 0.00000000 -0.35682209 0.00000000 0.35682209 0.93417236 0.00000000 -0.35682209 0.93417236 0.00000000 0.35682209 -0.93417236 0.00000000 -0.35682209 -0.93417236

dode2.xyz (movable pointcloud) 10.57735027 0.57735027 0.57735027 10.57735027 0.57735027 -0.57735027 10.57735027 -0.57735027 0.57735027 10.57735027 -0.57735027 -0.57735027 9,42264973 0.57735027 0.57735027 9,42264973 0.57735027 -0.57735027 9,42264973 -0.57735027 0.57735027 9,42264973 -0.57735027 -0.57735027 10.35682209 0.93417236 0.00000000 9,64317791 0.93417236 0.00000000 10.35682209 -0.93417236 0.00000000 9,64317791 -0.93417236 0.00000000 10.93417236 0.00000000 0.35682209 10.93417236 0.00000000 -0.35682209 9,06582764 0.00000000 0.35682209 9,06582764 0.00000000 -0.35682209 10.00000000 0.35682209 0.93417236 10.00000000 -0.35682209 0.93417236 10.00000000 0.35682209 -0.93417236 10.00000000 -0.35682209 -0.93417236

here is the image of the result of the multiplication of the matrix (i did on Matlab online ) multiplication of matrix for finding new points

and here the algorithm : Capture d’écran du 2023-05-03 16-53-10

if you have any clue about it would help me !