[SciPy-User] Fitting a model to an image to recover the position
Mon Oct 3 08:29:52 CDT 2011
On 09/30/2011 05:18 PM, Niemi, Sami wrote:
> I am trying to solve a problem where I need to fit a model to an image to recover the position (of the model in that image). The real-life application is more complicated (fitting sparse field spectroscopic data to an SDSS r-band image, if you are interested in) than the simple example I give below, but it is analogous. The most significant difference being that in the real-life application I need to allow rotations (so I need to find a position x and y and rotation r that minimizes for example the chi**2 value) and that the difference between the model and image might be larger than the small random error applied in the simple example (and that there is less information in one of the directions because of the finite slit width).
> The simple example I show below works for the real-life problem, but it's far from being effective or elegant. I would like to use some in-built minimization methods like scipy.optimize.leastsq to solve this problem but I haven't found a way to get it work on my problem. Any ideas how I could do this better?
You might be interested in a totally different approach: registration
(and rotation, if you want, but it's slightly more complicated) based on
fft phase correlation. Google 'fft registration' and/of 'fft
registration rotation' for more info, there is quite a lot available,
both theory and algorithmic.
I've been using it for coregistration of satellite images, and it works
wonderfully. You can even easily get sub-pixel accuracy if you want.
More information about the SciPy-User