Ask Your Question

Are 4 or more dimensions allowed in a Mat?

asked 2012-12-15 13:09:56 -0500

ZachTM gravatar image

Hi guys, I have been using opencv for a while now, but I now need to make matrices of 4, or 5 dimensions. I can create a matrix like:

int sz[] = {1,5,5,16,16};
Mat x = (5,sz,CV_32F, Scalar::all(0));

but<float>(1,1,1,1,1) is invalid. Are opencv Mat objects not able to handle anything greater than 3 dimensions? Or is there another way of accessing the elements. Thanks for any help!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-16 05:04:12 -0500

Michael Burdinov gravatar image

OpenCV has multi-dimension matrices.

First dimention of your matrix is 1, i.e. the only index within range is 0. When you call to (1,1,1,1,1) you should get out of range error.

edit flag offensive delete link more


Sorry for the late response, thanks for your answer, I cant believe I didn't notice that!

ZachTM gravatar imageZachTM ( 2012-12-29 19:29:33 -0500 )edit

Are u sure.. u can access 5D element. I read u can access only upto 3 D using Mat.

KK Nakka gravatar imageKK Nakka ( 2015-09-18 04:07:17 -0500 )edit

Question Tools


Asked: 2012-12-15 13:09:56 -0500

Seen: 1,558 times

Last updated: Dec 16 '12