Hi,<div><div>I compute the rigid transformation between 3D point set v1 and v2</div><div> v2 = s R v1 + T , based on Horn&#39;s derivation of the closed form least squares formulation</div><div>(for horns method see : <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.971&amp;rep=rep1&amp;type=pdf">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.971&amp;rep=rep1&amp;type=pdf</a> )</div>
<div><br></div><div>For this I have to solve a polynomial as an intermediate step.</div><div>However the function &quot; vnl_rnpoly_solve&quot; included in the ITK (vnl library) doesn&#39;t seem to be returning the correct</div>
<div>roots for a particular case.</div><div><br></div><div><br></div><div>a) BUGGY CASE: I used the following points:</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div>+9  -253 -1187</div></div><div><div>-45 -222 -740</div></div><div><div>-98 -223 -750</div></div><div><br></div><div>For this the polynomial coefficients would be (while registering above points to self) :</div><div>
<br></div><div><div>1.0000e+00   0.0000e+00  -4.0615e+09   4.0000e-06   4.1220e+18</div></div><div><br></div><div>The roots of the polynomial should be </div><div><div>   4.5546e+04</div></div><div><div>   4.4576e+04</div>
</div><div><div>  -4.5546e+04</div></div><div><div>  -4.4576e+04</div></div><div><br></div><div>But vnl_rnpoly_solve , doesn&#39;t return any root.</div></blockquote><div><br></div><div>b) CORRECT CASE:  I then scaled the points by 0.1 to get the modified points</div>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>+0.9 -25.3 -118.7</div></div><div><div>-4.5 -22.2 -74.0</div></div><div><div>-9.8 -22.3 -75.0</div></div><div>
<br></div><div>For this the polynomial coefficients would be (while registering above points to self) :</div><div><br></div><div><div>1.0000e+00   0.0000e+00  -4.0615e+07   0.0000e+00   4.1220e+14</div></div><div><br></div>
<div>For this the roots should be:</div><div><div>  -4554.6</div></div><div><div>  -4457.6</div></div><div><div>   4554.6</div></div><div><div>   4457.6</div></div><div><br></div><div>Which is what I get using VNL.</div></blockquote>
<div><br></div><div><br></div><div><br></div><div>This is how I get the coefficients:</div><div>a) center the point sets at their respective centroids </div><div>b) compute the cross covariance terms of the two centered datasets</div>
<div>c) Form the matrix &quot;N&quot; as in horns method</div><div>d)  form the quartic coefficients of the characteristic equation of </div><div>     matrix N for solving for the rotation in terms of quaternions </div><div>
e) Solve the polynomial with co-efficients from step (d)</div><div><br></div><div>I have included a test program. To make the code simple I only included the polynomial solving part in the test code.</div><div><br></div><div>
Thanks,</div><div>Somi</div><div><br></div><div><br></div></div>