The code below causes an exception. Why?
#include
#include
using namespace cv;
using namespace std;
void mai
Because the last parameter is optional and also the data pointer should point somewhere appropriate:
//inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
double mydata[1];
Mat m1 = Mat(1,1, CV_64F, mydata);
m1.at(0,0) = 0;
But better do it directly with this template-based constructor:
//inline Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
Mat m1 = Mat(1,1, CV_64F, cvScalar(0.));
//or even
Mat m1 = Mat(1,1, CV_64F, double(0));