Ask Your Question

Revision history [back]

cat isn't a standard function in C or C++ like it is in Matlab, you will have to implement the functionality yourself to match your needs. However, it is already weird that you only have two arguments for your matlab function, since documentation clearly states that min 3 arguments are needed.

I will explain the basics.


Cat function takes in account the number of dimensions and the matrices that need to be concatenated. 3 means you will use several 2D matrices into a 3D matrix structure.

C/C++ - OpenCV

Easiest way to do this is to create a 3D Mat structure, which can be done by using vectors. You can then copy each Mat that needs to be concatenated into the specified vector.

Example code:

Mat matrix_1;
Mat matrix_2;
vector<Mat> result;

If you want it for an arbitrary number of matrices, create a for loop structure.