报错:
error: conversion from ‘Sophus::SE3f {aka Sophus::SE3}’ to non-scalar type ‘cv::Mat’ requested
error: no matching function for call to ‘std::vectorcv::Mat::push_back(Eigen::Vector3f)’
error: conversion from ‘Eigen::Vector3f {aka Eigen::Matrix<float, 3, 1>}’ to non-scalar type ‘cv::Mat’ requested
解决方法:
参考https://github.com/UZ-SLAMLab/ORB_SLAM3/issues/442
在ros_mono_ar.cc文件约151行左右把下面这行注释掉(前面加双斜杠即可
cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
然后加入在这行前面加入以下内容:
cv::eigen2cv (pMP->GetWorldPos(), WorldPos);
vPoints.push_back(WorldPos);
cv::Mat Xw;
cv::eigen2cv (pMP->GetWorldPos(), Xw);
cv::Mat K;
cv::Mat DistCoef;
cv::Mat WorldPos;
cv::Mat im = cv_ptr->image.clone();
cv::Mat imu;
// cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
cv::Mat Tcw;
Sophus::SE3f Tcw_SE3f = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
Eigen::Matrix4f Tcw_Matrix = Tcw_SE3f.matrix();
cv::eigen2cv(Tcw_Matrix, Tcw);
就可编译成功。
/
编译失败了…
试了orb-slam2的 成功了