Levenberg-Marquardt Algorithm

Christian Gollwitzer auriocus at gmx.de
Wed Apr 11 03:19:44 EDT 2018

Am 11.04.18 um 08:38 schrieb Priya Singh:
> I have two 2D arrays one R and another T (which is also a 2D array).
> Do you know how can I fit T with R in order to find central
> coordinate x0,y0 for T relative to R???
> So the main question is do you know in python how can I fit two 2D arrays to find
> x0,y0 for one array relative to other. I shall use LM fit in python. But for fitting, I need to have some fittable model but here I am having only two 2D arrays. I know simple cross-correlation would have solved my problem but I have been instructed to do fitting using one array to other.

The request is nonsense. LM fits an analytical model to data, if you 
don't have an analytical model, you need another tool. Cross correlation 
is widely used and works well for many such tasks.

In principle you could also interpolate the one array to new 
coordinates, e.g. using scipy.ndimage.interpolation.shift, and minimize 
the sum of squared differences. But still LM is the wrong tool here, it 
would get trapped in local minima soon, and it uses derivatives. Look 
for "image registration" to find typical algorithms used in this context.


More information about the Python-list mailing list