Ask Your Question
0

Are 4 or more dimensions allowed in a Mat?

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

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 x.at<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
4

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

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

Comments

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 -0600 )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 -0600 )edit

Question Tools

Stats

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

Seen: 2,580 times

Last updated: Dec 16 '12