The code below causes an exception. Why?
#include
#include
using namespace cv;
using namespace std;
void mai
How to fill Matrix with zeros in OpenCV?
To fill a pre-existing Mat object with zeros, you can use Mat::zeros()
Mat m1 = ...;
m1 = Mat::zeros(1, 1, CV_64F);
To intialize a Mat so that it contains only zeros, you can pass a scalar with value 0 to the constructor:
Mat m1 = Mat(1,1, CV_64F, 0.0);
// ^^^^double literal
The reason your version failed is that passing 0 as fourth argument matches the overload taking a void* better than the one taking a scalar.