Matrix rotation error and how pull out a single element
Hi, I have problem with matrix rotation. I am using the module Aruco to receive marker position. Then I use the function Rodrigues () to receive a rotation matrix. I would like to pull out of the matrix as a single element needs to calculate the orientation of the marker. But all the time I error. The following code:
cv::Mat rvecs, tvecs;
// detect markers and estimate pose
aruco::detectMarkers(image, dictionary, corners, ids, detectorParams, rejected);
if (estimatePose && ids.size() > 0)
aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs, tvecs);
double currentTime = ((double)getTickCount() - tick) / getTickFrequency();
Mat R = Mat::zeros(3, 3, CV_64F);
Rodrigues(rvecs, R);
Here is the formula:
Mat Thz = (atan2 (R (3), R (0))) * (180 / M_PI)
But the problem is in the variables.
When I'm use R.at <double> (1, 1)
displays a single element matrix. For example, when I give Mat thz = atan2 (R.at <double> (1, 1), R.at <double> (1, 2));
,
displays error C2440: 'initializing': can not convert from 'double' this' cv :: Mat
How do I convert the matrix R so I can use them with designs and functions atan2?
*Professor at the University gave me this formula
*I know that it is a vector of rotation, according to Professor I do with this design, which is why it needs rotation matrix.
*The main idea is that I received the position and orientation of the marker relative to the camera. I needs this to the vision system robot. To be able later to steer the robot at reasonably "When X> 10 move to the left of 5, etc." when the camera will centered over the marker the robot takes the object