1
以下是我的函数原型。错误:类型'cv :: Mat&'的非const引用无效初始化
void devectorize(Mat &vec,Mat mask,Mat& img);
当我尝试在我的代码中调用此函数时出现以下错误。这是什么原因?
Mat V;
for(int i=0;i<V.cols;i++)
{
devectorize(V.col(i),mask,E_img); //Error in this line
}
error: invalid initialization of non-const reference of type 'cv::Mat&' from an rvalue of type 'cv::Mat' utils.h:11:6: error: in passing argument 1 of 'void devectorize(cv::Mat&, cv::Mat, cv::Mat&)'
http://eli.thegreenplace.net/2011/12/15/understanding-lvalues-and-rvalues-in-c-and-c/ – BartoszKP
我重新标记了你的问题。 – LihO