Convert tf::Matrix3x3 to cv::Mat [closed]
Hi everyone, i tried to convert tf::Matrix3x3 to cv::Mat, but having NaN result. I don't understand why... This is my function:
Mat quat2Mat(geometry_msgs::Quaternion quat)
{
tf::Quaternion q(quat.x, quat.y, quat.z, quat.w);
tf::Matrix3x3 m(q);
Mat rotm_mat(3, 3, CV_64F);
for(int i = 0; i < 3; i++)
{
tf::Vector3 test = m.getRow(i);
rotm_mat.at<double>(i, 0) = test.getX();
rotm_mat.at<double>(i, 1) = test.getY();
rotm_mat.at<double>(i, 2) = test.getZ();
}
return rotm_mat;
}