OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Fri, 18 Sep 2015 04:07:17 -0500Are 4 or more dimensions allowed in a Mat?http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/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!Sat, 15 Dec 2012 13:09:56 -0600http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/Answer by Michael Burdinov for <p>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:</p>
<pre><code>int sz[] = {1,5,5,16,16};
Mat x = (5,sz,CV_32F, Scalar::all(0));
</code></pre>
<p>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!</p>
http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/?answer=5242#post-id-5242OpenCV 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.Sun, 16 Dec 2012 05:04:12 -0600http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/?answer=5242#post-id-5242Comment by KK Nakka for <p>OpenCV has multi-dimension matrices.</p>
<p>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.</p>
http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/?comment=71152#post-id-71152Are u sure.. u can access 5D element. I read u can access only upto 3 D using Mat.Fri, 18 Sep 2015 04:07:17 -0500http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/?comment=71152#post-id-71152Comment by ZachTM for <p>OpenCV has multi-dimension matrices.</p>
<p>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.</p>
http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/?comment=5585#post-id-5585Sorry for the late response, thanks for your answer, I cant believe I didn't notice that!Sat, 29 Dec 2012 19:29:33 -0600http://answers.opencv.org/question/5232/are-4-or-more-dimensions-allowed-in-a-mat/?comment=5585#post-id-5585