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