Levenberg-Marquardt Algorithm

Priya Singh sapna.intell at gmail.com
Sat Apr 14 14:25:56 EDT 2018

```

On

On Wednesday, April 11, 2018 at 12:49:59 PM UTC+5:30, Christian Gollwitzer wrote:
> 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.
>
>
>
> 	Christian

I am really sorry, I should rather ask this way.

I have two 2D arrays and one array I want to present in cubic spline way. And with this cubic spline representation of one array, I want to fit the other array. But the problem is that in python I have only cubic spline interpolation task, I want to get the form of this representation and then with this form I want to fit another 2D array to get the position of centers of the second array relative to the first array. I have used image registration for the centering which is based on FFT. But I have been instructed to use this method only.

So basically can anyone tell me how to get functional for of 2D cubic spline function in python? For 1D I have got many helps but not for 2D.

```