Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

rows and cols only make sense in a 2d context, with higher dimensional Mat's you'll have to look at the size member like:

cout << L.size << endl;

4 x 3 x 2 x 5

also, there are only suitable print functions for 2d Mat's, but you may "slice" your multi-dimensional Mat into planes, and visualize / print out those:

Mat slice(2,5,CV_8U, L.ptr<uchar>(3,2));
cout << slice << endl;

[  0,   0,   0,   0,   0;
   0,   0,   0,   0,   0]

rows and cols only make sense in a 2d context, with higher dimensional Mat's you'll have to look at the size member like:

cout << L.size << endl;

4 x 3 x 2 x 5

also, there are only suitable print functions for 2d Mat's, but you may "slice" your multi-dimensional Mat into planes, and visualize / print out those:

Mat slice(2,5,CV_8U, L.ptr<uchar>(3,2));
slice(2, 5, CV_8U, L.ptr<uchar>(3,2)); // last element, just as an example
cout << slice << endl;

[  0,   0,   0,   0,   0;
   0,   0,   0,   0,   0]