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

Charles R Harris charlesr.harris@gmail....
Thu Mar 4 20:54:10 CST 2010


On Thu, Mar 4, 2010 at 3:18 PM, Massimo Di Stefano
<massimodisasha@yahoo.it>wrote:

> 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!!!
>
>
You're welcome ;) Note that it is easy to extend to more than three vectors.


> i've a question about the code,
> what does :
>
> #
> res = rhs - np.dot(A, sol)
> #
>
>
It's the residuals, i.e., the error remaining after the fit. I find the
residuals generally more informative than their squared norm that is
returned by the lstsq function.


>
> 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.
>
>
<snip>

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100304/5b21437e/attachment.html 


More information about the SciPy-User mailing list