When I try to initialize a cv::Mat
with
mask = cv::Mat::zeros(20, 1, CV_8U);
or
mask = cv::Mat(20, 1, CV_8U, 1);
I seem to get a correctly initialized Mat. But
mask = cv::Mat(20, 1, CV_8U, 0);
throws this runtime error when I simply use std::cout << mask.size() << std::endl;
or std::cout << mask << std::endl;
OpenCV Error: Assertion failed (total() == 0 || data != NULL) in Mat, file /usr/local/include/opencv2/core/mat.inl.hpp, line 579 terminate called after throwing an instance of 'cv::Exception' what(): /usr/local/include/opencv2/core/mat.inl.hpp:579: error: (-215) total() == 0 || data != NULL in function Mat
which is strange... Any idea why this might be happening?