Ask Your Question

N-dimentional Matrix support

asked 2012-11-30 09:48:08 -0600

ryhor gravatar image

updated 2012-12-03 08:58:39 -0600

Could you please tell me is there support for n-dim matrix to reflect these Matlab operations:

a = zeros([3 3 5]) - well I know there is Mat::create(int, int*, int)

b = a(2,2,:) - i.e. I would like stack of elements "in depth" of my 3d matrix

c = a(:,2,:) - i.e. I would like this slice of data

s = sum(a,2) - i.e. I would like to sum along dimension 2

I have assumed it is basic types of data processing, but to my surprise at the moment it looks like OpenCV is lacking of these basics. Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-02 05:35:17 -0600

Michael Burdinov gravatar image

Those are indeed basic types for data processing, but OpenCV is not a general purpose libary. It is "Open Computer Vision" library, i.e. this is collection of data structures and algorithms that are frequently used for Computer Vision and Image Processing. I guess slicing multi-dimentional matrix don't really fit to OpenCV.

edit flag offensive delete link more


Well.. 3D "cost" volume is one of example, which is quite widely used for boosted detector training and for stereo algorithms.

I.e. why not to do it right ones and for all? why to skip basics and implement something "complicated"?

And finally It is just data manipulation or even just data representation.

ryhor gravatar imageryhor ( 2012-12-03 05:45:52 -0600 )edit

You are right that OpenCV indeed missing certain basic operations. But this is open source library so if it has some complicate algorithm that means that more people needed it than some basic one. As for 3D slices: OpenCV can do slices in 2D images, so you can make operation with 3D array as combination 2D operations. This is not as clean as it may be in Matlab, but this should do the work.

Michael Burdinov gravatar imageMichael Burdinov ( 2012-12-04 05:13:49 -0600 )edit

Question Tools


Asked: 2012-11-30 09:48:08 -0600

Seen: 501 times

Last updated: Dec 03 '12