I am trying to fine-tune a transformation from one set of coordinates to another.
x' = R + Px + Qy
y' = S - Qx + Py
Where P,Q,R,S are constants, P = scale*cos(rotation). Q=scale*sin(rotation)
There is a well-known “manual” formula for fitting P, Q, R, S to a set of corresponding points. But I need to have a fit error estimate - so I need a least squares solution.
Read the Numerical Recipes, but I am having trouble developing how to do this for datasets with x and y in them.
Can someone point out an example / tutorial / sample code on how to do this?
Not too worried about the language.
But - just use the built-in Matlab / Lapack / numpy / R function, probably not useful!
edit: I have a large set of old (x, y) new (x, y) to match. The problem is overridden (there are more data points than unknowns), so a simple matrix inversion is not enough - and, as I said, I really need an error when fitting.
source
share