C++ StereoRective()的参数6中的输入数组类型出错
在计算立体图像的视差图之后,我需要从立体图像中计算点云。 请在以下地址查找代码: 我在编译时遇到此错误:C++ StereoRective()的参数6中的输入数组类型出错,c++,opencv,point-cloud-library,ros,C++,Opencv,Point Cloud Library,Ros,在计算立体图像的视差图之后,我需要从立体图像中计算点云。 请在以下地址查找代码: 我在编译时遇到此错误: invalid initialization of reference of type ‘cv::InputArray {aka const cv::_InputArray&}’ from expression of type ‘Eigen::Matrix3d {aka Eigen::Matrix<double, 3, 3>}’ stereoRectify(l
invalid initialization of reference of type ‘cv::InputArray {aka const cv::_InputArray&}’ from expression of type ‘Eigen::Matrix3d {aka Eigen::Matrix<double, 3, 3>}’ stereoRectify(left_K,left_D,right_K,right_D,disp.size(),mR,t,R1,R2,left_P,right_P,Q);
^
从'Eigen::Matrix3d{aka Eigen::Matrix3d}'类型的表达式中初始化'cv::InputArray{aka const cv::_InputArray&}'类型的引用无效(left_K,left_D,right_K,right_D,disp.size(),mR,t,R1,R2,left_P,right_P,Q);
^
谢谢经过几个小时的研究,我想我得到了这个。错误是由于在第6个参数和第7个参数中传递特征类型输入无效 soln是特征类型矩阵到cv::Mat类型预期参数(inputArray)之间的转换
材料R1、R2、Q;
本征::四元数q=旋转[0];
本征::Vector3d t=trans[0];
编译器会告诉您类型是什么,以及它真正需要什么。现在,您必须考虑如何将您的类型转换(而不是强制转换!)为预期的类型。或者阅读一篇参考文献,看看你是否真的通过了正确的论证。你能帮我转换吗
invalid initialization of reference of type ‘cv::InputArray {aka const cv::_InputArray&}’ from expression of type ‘Eigen::Matrix3d {aka Eigen::Matrix<double, 3, 3>}’ stereoRectify(left_K,left_D,right_K,right_D,disp.size(),mR,t,R1,R2,left_P,right_P,Q);
^
Mat R1, R2, Q;
Eigen::Quaterniond q = rots[0];
Eigen::Vector3d t = trans[0];
std::cout << q.matrix() << std::endl;
std::cout << t << std::endl;
// Converting Eigen type to Opencv type inputArray ---> Mat
Eigen::Matrix3d mR = q.matrix();
cv::Mat mr2 = cv::Mat::eye(3,3, CV_64F);
eigen2cv(mR, mr2);
cv::Mat T = cv::Mat::zeros(3,1,CV_64F);
T.at<double>(0,0) = t(0,0);
T.at<double>(0,1) = t(1,0);
T.at<double>(0,2) = t(2,0);