I am surprised why FindGeometricTransform is failing to automatically register or align two sets of points that are drawn from a Ball. I know that one can change the Method and the TransformationClass to get the result but the developers mention that the function takes the most appropriate settings for alignment by default. This does not seem to be the case.

I have tried this in Version 12.0 running on Windows 10

pts1 = RandomPoint[Ball[], 5000];
pts2 = RandomPoint[Ball[{1.5, 1.5, 1.5}, 1], 5000];

{err, geomtrans} = FindGeometricTransform[pts1, pts2];

Graphics3D[{Red, Point@pts1, Blue, Point@(geomtrans@pts2)}]

the bizarre result is below (looks like the Solver chose RANSAC).

enter image description here

The same result can be obtained by using FindGeometricTransform[pts1, pts2, Method -> "RANSAC"];

Keeping the Method -> "RANSAC" the result is still wrong (off centered) if I specify TransformationClass -> "Translation"

enter image description here

The result is totally wrong if I specify TransformationClass -> "Rigid" with Method specified as RANSAC. The solver should not do any ScalingTransform

enter image description here

The only time it gives me correct result is if I use Method -> "Linear" with either TransformationClass -> "Translation" or TransformationClass -> "Rigid"

enter image description here

I do not understand whether to consider this to be a bug since some transformations are doing scaling albeit the fact that the transformation should be rigid??

This is not an answer but rather something I do not understand. This seems quite Bizarre to me the more I think about it.

pts = RandomPoint[Ball[], 10000];
pts2 = Map[RandomReal[{0, 0.5}, 3] + {1.5, 0, 0} + # &, pts]; (* points with noise and translation *)
pts3 = RandomPoint[Ball[{1.5, 0, 0}, 1], 10000]; (* points sampled from another ball that is only translated *)

{err, geom} = FindGeometricTransform[pts, pts2, Method -> "RANSAC",TransformationClass -> "Rigid"];

{err, geom3} = FindGeometricTransform[pts, pts2, Method -> "Linear",TransformationClass -> "Rigid"];

{err2, geom2} = FindGeometricTransform[pts,pts3,Method ->"RANSAC", TransformationClass -> "Rigid"];

{err2, geom4} = FindGeometricTransform[pts,pts3,Method ->"Linear", TransformationClass -> "Rigid"];

Now let us draw the results.

The first registration with "RANSAC" geom seems reasonable although I can observe a little scaling when compareed to "Linear" geom3

{Graphics3D[{Red, Point@pts, Blue, Point@pts2}], Graphics3D[{Red, Point@pts,Blue, Point@geom@pts2}],Graphics3D[{Red, Point@pts, Blue, Point@geom3@pts2}]}

enter image description here

The second one is incorrect with "RANSAC" geom2 and correct with "Linear" geom4

{Graphics3D[{Red,Point@pts, Blue, Point@pts3}],Graphics3D[{Red,Point@pts,Blue, Point@geom2@pts3}],Graphics3D[{Red, Point@pts, Blue, Point@geom4@pts3}]}

enter image description here

  • $\begingroup$ Your point sets aren't related. That's why FindGeometricTransformation fails. $\endgroup$ – Ulrich Neumann Oct 13 '20 at 9:48
  • $\begingroup$ @UlrichNeumann I don't understand what you mean by not related. They don't need to be related but can nevertheless be registered using an error minimization scheme. Method -> Linear works so why not the default settings. $\endgroup$ – Ali Hashmi Oct 13 '20 at 9:52
  • $\begingroup$ I think you misunderstood what is possible. Giving two different sets of 5000 random points on two different spheres and you are asking for one function that maps the second set one to one onto the first set. Imagine what horrible function that must be! In any case, there is certainly no affine or perspective transformation function that can do this. However, it would work if you would translate and rotate the first sphere, with the points attached, to get the second set. $\endgroup$ – Daniel Huber Oct 13 '20 at 9:56
  • $\begingroup$ @ AliHashmi What transformation do you expect from the mapping p1->p2? $\endgroup$ – Ulrich Neumann Oct 13 '20 at 9:56
  • 1
    $\begingroup$ I agree that "Rigid" should only to rotation and translation. "Similarity" should do in addition stretching. $\endgroup$ – Daniel Huber Oct 13 '20 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.