6
$\begingroup$

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?

$\endgroup$

1 Answer 1

11
$\begingroup$

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]

Mathematica graphics

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.