[Insight-users] vnl differences from VS2008 and command prompt
John D
john.dz.eis at gmail.com
Tue Aug 31 21:17:16 EDT 2010
Hi Dzenan,
Thanks for the reply. I do not think my problem is similar since I am
printing out the values. So it is not a problem with what the debugger is
showing. It seems to be more of a vnl thing.
Regards,
John
2010/8/31 Dženan Zukić <dzenanz at gmail.com>
> I have problem with VS2008 debugger showing junk when osg::Vec3 is passed
> to a function by value. The code sees the proper value, just the debugger
> shows junk (usually some very small denormalized numbers). I am not sure
> whether this is helpful, but it might be related.
>
> Regards,
> Dženan
>
> On Tue, Aug 31, 2010 at 01:42, John D <john.dz.eis at gmail.com> wrote:
>
>> Hi all,
>>
>> 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.
>>
>> I am trying to decompose an affine matrix into its components and here is
>> the code:
>>
>> //Compute the rotation angle and scaling from SVD of the matrix.
>> vnl_matrix<double> p(2, 2);
>> p[0][0] = (double) vOutputParameters[0];
>> p[0][1] = (double) vOutputParameters[1];
>> p[1][0] = (double) vOutputParameters[2];
>> p[1][1] = (double) vOutputParameters[3];
>> vnl_svd<double> svd(p);
>> vnl_matrix<double> r(2, 2);
>>
>> vnl_matrix<double> scalingDiag(2, 2);
>> scalingDiag[0][0] = svd.W(0);
>> scalingDiag[1][1] = svd.W(1);
>>
>> vnl_matrix<double> scalingMat(2, 2);
>> scalingMat = svd.V()*scalingDiag*vnl_transpose(svd.V());
>>
>> vnl_matrix<double> rotationMat(2,2);
>> rotationMat = svd.U()*vnl_transpose(svd.V());
>> double angle = -atan(rotationMat[0][1]/rotationMat[0][0]);
>> double sinAngle = sin(angle);
>>
>> std::cout << " Lambda1 : = " << svd.W(0)<< std::endl;
>> std::cout << " Lambda2 : = " << svd.W(1)<< std::endl;
>> std::cout << " V : = " << svd.V()<< std::endl;
>> std::cout << " U : = " << svd.U()<< std::endl;
>>
>> std::cout << " Scale 1 = " <<
>> scalingMat[0][0] << std::endl;
>> std::cout << " Scale 2 = " <<
>> scalingMat[1][1] << std::endl;
>> std::cout << " Angle (degrees) = " << angle * 45.0 / atan(1.0)
>> << std::endl;
>> std::cout << " Skew X = " << scalingMat[0][1]
>> << std::endl;
>> std::cout << " Skew Y = " << scalingMat[1][0]
>> << std::endl;
>>
>> 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
>> to run from the commandline also)
>>
>> For ex:
>> [ 0.99307 0.00623954;
>> 0.00623954 0.996727];
>>
>> However from the command prompt, I get the following:
>> [0.992893 0.810226;
>> -0.798249 0.996677];
>>
>> Has anybody had problems like this before ? How can it be fixed?
>> Thanks,
>> John
>>
>>
>>
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100831/df9e470f/attachment.htm>
More information about the Insight-users
mailing list