aruco giving strange rotations.
Hi, I am tracking aruco markers in an openCv application. I am using the left frame of a calibrated stereo camera, so the image is undistorted and rectified. As such, i pass 0 parameters to the distortion matrix.
I have the camera pointing down at the floor, and measure the angle with an IMU. The result is 37 degrees in pitch.
I have a marker set up, on the floor, as straight as I can get it in front of the camera.
When I print the rvecs value returned from the marker, I would expect to see something like:
Yaw 0, Roll 0, Pitch -37
but what I do see ( after applying *180 / M_PI;) is:
[131.865, -0.295742, 1.04376]
The rotation is only one axis, which looks right, but the value is a long way off from what it should be. Am I missing something? Or is this as accurate as Aruco gets with a single marker?
(the axis displayed in frame looks correct, but the value returned does not)
As a bonus question.. is it possible to return quaternions from Aruco tracking?
Thanks!
EDIT:
I now have:
cv::Mat expected;
cv::Rodrigues(rvecs[i], expected);
Eigen::Quaterniond mOrientationEigen = toQuaternionOg(expected);
Eigen::Quaterniond toQuaternionOg(const cv::Mat &M)
{
Eigen::Matrix<double, 3, 3> eigMat = toMatrix3d(M);
Eigen::Quaterniond q(eigMat);
return q;
}
But the returned quaternions are garbage:
3.89581e-181.20234e+173.03257e-186.61337e+09
Where am I going wrong here?
Did you check if when you print
eigMat
is equal toM
?Check if you are handling doubles or floats. Probably is somehow you are mixing types, the result would be garbage...