Concatenate mat in OpenCV

I have several images in Matobjects with the same size. I would like to create one bix object cv::Matto hold them all

Thus, the size of the new matrix: widthNew = widthOld x the number of matrices, the height remains unchanged.

I found that such a copy can be made using:

void cvCopy(const CvArr* src, CvArr* dst, const CvArr* mask=NULL)

but then, how can you define a mask three different times for three matrices ?.

Regards, Moataz

+5
source share
3 answers

You use roi to identify the image, which is actually the area of ​​the target image, and then copy it. see Copy cv :: Mat inside ROI of another

+5
source

, . OpenCV , hconcat() vconcat(). - , - .

:

Mat A, B;
... //In this part you initialize the Mat A and Mat B.

Mat H, V; //These are the destination matrices
hconcat(A, B, H);
vconcat(A, B, V);

, .

+2

, cvShowManyImages(), , 3- , :

, ROI .

, , .

, IplImage ↔ cv::Mat, .

+1

All Articles