# Revision history [back]

### How to get dimensions (d > 2) of Mat

Hi all,

Sorry to disturb you.

As we know Mat::size() will work only dimensions <= 2. Could you please tell me how can we get the dimension if it's greater than 2 ?

Thank you.

### How to get dimensions (d > 2) of Mat

Hi all,

Sorry to disturb you.

As we know Mat::size() will work only dimensions <= the dimension of Mat is not greater than 2. Could you please tell me how we can we get the dimension if it's greater than 2 ?

Thank you.

### How to get dimensions (d > 2) of Size for N (N>2) dimensional Mat

Hi all,

Sorry to disturb you.

As we know Mat::size() will work only the dimension of Mat is not greater than 2. Could you please tell me how we can get the size if the dimension if it's is greater than 2 ?

For example, if I create a Mat by Mat(3, (int[]) {3,4,5}, CV_64F), we can get its dimension via Mat::dims or Mat::size.p[-1], but how can we get its size, i.e. {3,4,5} ?

Thank you.

### How to get Size for N (N>2) dimensional Mat

Hi all,

Sorry to disturb you.

As we know Mat::size() will work only the dimension of Mat is not greater than 2. Could you please tell me how we can get the size if the dimension is greater than 2 ?

For example, if I create a Mat by Mat(3, (int[]) {3,4,5}, CV_64F), we can get its dimension via Mat::dims or Mat::size.p[-1], but how can we get its size, i.e. {3,4,5} ?

Thank you.

SOLVED Use Mat::size and cast it into const int*, then we can get an array to indicate the length of each dimension.

### How to get Size for N (N>2) dimensional Mat

Hi all,

Sorry to disturb you.

As we know Mat::size() will work only the dimension of Mat is not greater than 2. Could you please tell me how we can get the size if the dimension is greater than 2 ?

For example, if I create a Mat by Mat(3, (int[]) {3,4,5}, CV_64F), we can get its dimension via Mat::dims or Mat::size.p[-1], but how can we get its size, i.e. {3,4,5} ?

Thank you.

SOLVED
Use Mat::size and cast it into const int*, then we can get an array to indicate the length of each dimension.