Wednesday, 18 September 2013

How do i get the size of a multi-dimensional cv::Mat? (Mat, or MatND)

How do i get the size of a multi-dimensional cv::Mat? (Mat, or MatND)

I am creating a multi-dimensional MAT object, and would like to get the
size of the object - e.g.,
const int sz[] = {10,10,9};
Mat temp(3,sz,CV_64F);
std::cout << "temp.dims = " << temp.dims << " temp.size = " << temp.size()
<< " temp.channels = " << temp.channels() << std::endl;
I believe the resulting MAT to be 10x10x9, and I'd like to confirm, but
the COUT statement gives:
temp.dims = 3 temp.size = [10 x 10] temp.channels = 1
I was hoping to see either:
temp.dims = 3 temp.size = [10 x 10 x 9] temp.channels = 1
Or:
temp.dims = 3 temp.size = [10 x 10] temp.channels = 9
How can I get the dimensionality of this Mat object? I didn't see any
methods in Mat::Mat or MatND

No comments:

Post a Comment