Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

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

share|improve this answer
    
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! :) –  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 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 at 12:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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