Ask Your Question

Revision history [back]

I have no idea why the function static MatExpr zeros(int _ndims, const int* _sizes) is removed in OpenCV 2.4.x (or not?). But if you want to have a ndims Mat initialized by zeros, you can do like that (in OpenCV 2.4.8):

Mat ucMat = Mat::zeros(nrows, ncols, CV_8UC(ndims)); // for unsigned char
Mat intMat = Mat::zeros(nrows, ncols, CV_32SC(ndims)); // for int
Mat fMat = Mat::zeros(nrows, ncols, CV_32FC(ndims)); // for float
Mat dMat = Mat::zeros(nrows, ncols, CV_64FC(ndims)); // for double

I have no idea why the function static MatExpr zeros(int _ndims, const int* _sizes) is removed in from OpenCV 2.4.x (or not?). But if you want to have a ndims Mat initialized by zeros, you can do like that (in OpenCV 2.4.8):

Mat ucMat = Mat::zeros(nrows, ncols, CV_8UC(ndims)); // for unsigned char
Mat intMat = Mat::zeros(nrows, ncols, CV_32SC(ndims)); // for int
Mat fMat = Mat::zeros(nrows, ncols, CV_32FC(ndims)); // for float
Mat dMat = Mat::zeros(nrows, ncols, CV_64FC(ndims)); // for double