# [SciPy-User] helmert implementation (7 parameters - geometric transformation)

Massimo Di Stefano massimodisasha@yahoo...
Thu Mar 4 16:18:00 CST 2010

```Hi Charles,

apologize me, i had only now a chance to answer your mail.

i'm really gratefull for your help,
now the code works perfectly and i'm really really happy for this !

i tried it with some points and all works fine :-)

reading it i also learned some functions like :

np.newaxis
linalg.lstsq

you gived me an awesome help, thanks!!!

i've a question about the code,
what does :

#
res = rhs - np.dot(A, sol)
#

in the code i added the equation to apply the transformation to an input file with coordinates to be converted :

XYZ = np.loadtxt(str(inputf))
XYZsize = XYZ.shape[0]
ENZglob = np.zeros((XYZsize,3),float)
for i in np.arange(XYZsize):
X = sol[0] + (1 + sol[6]) * ( XYZ[i,0] - sol[5] * XYZ[i,1]  + sol[4] * XYZ[i,2] )
Y = sol[1] + (1 + sol[6]) * ( sol[5] * XYZ[i,0] + XYZ[i,1] - sol[3] * XYZ[i,2] )
Z = sol[2] + (1 + sol[6]) * ( -sol[4] * XYZ[i,0] + sol[3] * XYZ[i,1] + XYZ[i,2] )
ENZglob[i,:] = np.hstack((X,Y,Z))
np.savetxt(output,ENZglob)

thanks again!!!

regards,

Massimo.

Il giorno 03/mar/2010, alle ore 02.02, scipy-user-request@scipy.org ha scritto:

> I've attached a script for the computation. Two things of note: the angles
> in the pdf results are in degrees, the value of ? is pretty much in the
> noise (the condition number of the matrix is 10^10), and the fit you get
> with my version differs from the data by about 7mm. Note that the Helmert
> parameters result from a linearization of the rotation matrix, see
> Gauss-Newton for more about linearization and least squares, but in this
> case I think the limiting factor is the accuracy of the coordinates, not the
> linearization.

```

More information about the SciPy-User mailing list