terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(4.3.0) /home/zyl/ubuntu/opencv/opencv4.3.0/opencv-4.3.0/modules/core/src/matrix_expressions.cpp:24: error: (-5:Bad argument) Matrix operand is an empty matrix. in function ‘checkOperandsExist’
不能对未初始化的Mat矩阵直接进行数值操作:
如:
cv::Mat test;
cout<<test*0<<endl;
或者直接数值操作:
cv::Mat test;
test*3;
我们需要初始化test后才能进行操作,保证在数值操作之前不能是空矩阵;
cv::Mat test=cv::Mat::zeros(4,4,CV_32F);
cout<<test*0<<endl;
这样就不会报错了;