Hi all,<br> <br> I am using some vnl calls and the results when I use the Visual Studio 2008 Debugger is different from the results if I run the program at the command prompt. The iresults I get from the debugger seem to be the correct one.<br>
<br>I am trying to decompose an affine matrix into its components and here is the code:<br><br> //Compute the rotation angle and scaling from SVD of the matrix.<br> vnl_matrix<double> p(2, 2);<br> p[0][0] = (double) vOutputParameters[0];<br>
p[0][1] = (double) vOutputParameters[1];<br> p[1][0] = (double) vOutputParameters[2];<br> p[1][1] = (double) vOutputParameters[3];<br> vnl_svd<double> svd(p);<br> vnl_matrix<double> r(2, 2);<br>
<br> vnl_matrix<double> scalingDiag(2, 2);<br> scalingDiag[0][0] = svd.W(0);<br> scalingDiag[1][1] = svd.W(1);<br><br> vnl_matrix<double> scalingMat(2, 2);<br> scalingMat = svd.V()*scalingDiag*vnl_transpose(svd.V());<br>
<br> vnl_matrix<double> rotationMat(2,2);<br> rotationMat = svd.U()*vnl_transpose(svd.V());<br> double angle = -atan(rotationMat[0][1]/rotationMat[0][0]);<br> double sinAngle = sin(angle);<br>
<br> std::cout << " Lambda1 : = " << svd.W(0)<< std::endl;<br> std::cout << " Lambda2 : = " << svd.W(1)<< std::endl;<br> std::cout << " V : = " << svd.V()<< std::endl;<br>
std::cout << " U : = " << svd.U()<< std::endl;<br> <br> std::cout << " Scale 1 = " << scalingMat[0][0] << std::endl;<br>
std::cout << " Scale 2 = " << scalingMat[1][1] << std::endl;<br> std::cout << " Angle (degrees) = " << angle * 45.0 / atan(1.0) << std::endl;<br>
std::cout << " Skew X = " << scalingMat[0][1] << std::endl;<br> std::cout << " Skew Y = " << scalingMat[1][0] << std::endl;<br>
<br>scalingMat should be symmetric..which is the result I get from the debugger (The code is compiled as release and the debugger is running from the same directory which I use<br>to run from the commandline also)<br><br>
For ex:<br>[ 0.99307 0.00623954;<br> 0.00623954 0.996727];<br><br>However from the command prompt, I get the following:<br>[0.992893 0.810226;<br> -0.798249 0.996677];<br><br>Has anybody had problems like this before ? How can it be fixed?<br>
Thanks,<br>John<br><br><br><br><br>