Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the non-function size member of the Mat object. Also the dims member is handy, as follows. The size member is defined as an MSize object, but you can access it like an array. This solution requires NO CASTING.

const cv::Mat & srcImage;
int nDims = srcImage.dims;
int lastDim = srcImage.size[nDims-1];