# Finding an optimal overlay of two point clouds

Imagine I have two sets of points:

pointSetPerfect = Flatten[Table[{i, j}, {i, 10, 40, 10}, {j, 10, 40, 10}], 1];

pointSetNoise = Table[pointSetPerfect[[i]] + RandomReal[{-2, 2} - 100], {i, 1, Length[pointSetPerfect]}];

r = RotationTransform[47.5 Degree, {0, 2}];
pointSetNoise = r[pointSetNoise];

ListPlot[{pointSetPerfect, pointSetNoise}]


Without knowing what I did above to generate pointSetNoise, I would like to overlay, as best as I can, a set of points on pointSetNoise with the same interpoint spacings as in the point set pointSetPerfect, and return these coordinates. If necessary, I could also click on the image to specify by eye a (very approximate) 1-to-1 mapping between points in either set.

Is there a nice way of doing this in Mathematica v9?

-

try:

f = FindGeometricTransform[pointSetNoise, pointSetPerfect,
"Transformation" -> "Rigid", Method -> "FindFit"]


I know it's too short for an answer, but that's it.

The result can be tested like this:

ListPlot[{f[[2]][pointSetPerfect], pointSetNoise}, Axes -> False, Frame -> True]


-
Yes, that it certainly is. – RTaylor Oct 27 '13 at 17:27
I can't believe this was introduced in version 8 and I'm just now finding out about it. – RTaylor Oct 27 '13 at 17:37
@RTaylor Mathematica is huge! :) – Dr. belisarius Oct 27 '13 at 17:44
I would make sure the method is not set to "perspective" since that changes the inter point distances. "Affine" should do the trick. – lalmei Oct 23 '14 at 11:28
Actually the zero map is also affine but obviously doesn't preserve distances. What you want is a "Rigid" transformation. – Rahul Oct 23 '14 at 12:48