Registered Member
|
I needed to add some rotation math to some existing code. Surprisingly a rotation matrix got NaN coefficients and only the first rotation matrix in that function, the rest were fine. What helped was that I added a dummy rotation matrix before the one I needed and then my code worked, but I really need to understand what goes wrong there.
For debugging, I compiled the code with -ggdb and then the problem disappeared. When compiled with -O2 -g, I can see that the matrix coefs are set to zero in
Any ideas why is that?! An example snippet what does not work in the program as a first rotation matrix. In a separate test cpp file it works as it should.
|
Moderator
|
HArd to help without seeing the code. I recommend you to run your program under valgrind to check your are not reading uninitialized memory, are writing out of bounds, etc.
|
Registered Member
|
This was a weird issue. Thanks for the advice. Valgrind did not show any mistakes either.
Finally we found out, that the FPU stack was full after a certain OpenCV call and when Eigen pushed more data to FPU, it got corrupted, hence the NaNs. Probably the binary package of OpenCV we used was faulty, after changing the library files, the problem disappeared. |
Moderator
|
Indeed, that was a strange one.
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]