For the application 'aruco_test_markermap', the camera poses are invalid.
The error comes from the function : 'aruco_private::impl__aruco_getRTMatrix'.
It seems the _rvec & tvec OpenCV matrices provided by cv::solvePnP are in double instead of float. However, the pointers are reinterpreted as float instead of double.
the error is corrected by replacing (posetracker.cpp, line 50) :
float rx=_rvec.ptr<float>(0)[0]; float ry=_rvec.ptr<float>(0)[1]; float rz=_rvec.ptr<float>(0)[2]; float tx=_tvec.ptr<float>(0)[0]; float ty=_tvec.ptr<float>(0)[1]; float tz=_tvec.ptr<float>(0)[2];
by :
float rx=_rvec.ptr<double>(0)[0]; float ry=_rvec.ptr<double>(0)[1]; float rz=_rvec.ptr<double>(0)[2]; float tx=_tvec.ptr<double>(0)[0]; float ty=_tvec.ptr<double>(0)[1]; float tz=_tvec.ptr<double>(0)[2];
Compiled with :
aruco : 3.0.13 (also observed with 3.0.11)
opencv : 3.4.0 (also observed with 3.3.0)
OS : Windows 10 x64
Envi : VS Community 15.5.5
Compiler Options : Release x64
Instead of changing aruco_private::impl__aruco_getRTMatrix it is also possible to change the cv::solvePnP call in posetracker.cpp, line 341 with useExtrinsicGuess = true (default is false).
Then _rvec and _tvec are returned as float instead of double.
Last edit: Kiqo 2019-01-17
Thanks for your good comments. Now I have one question, For doing this I should correct the posetracker and then again build the library?
Dear friends,
I tried both the above method but erroe is still exists??!!!!
Yes to solve the issue you need to modify the source code and rebuild the library.
If the problem still persists, I'm not sure what could be the cause.
Do you have a different programming environment ? That may be the cause.
Initially, to find the error, I observed that the output of tvecs and
rvecs using std::cout was correct, but not once set as floats. Do you observe a similar behaviour ?
Hello,
Hello David, I solved the problem,. I removed the assert at the begining of the "impl__aruco_getRTMatrix" in posetracker.cpp. And it worked,. Thanks a lot for your comments.