opencvconcatenationopencv-mat

Concatenate Mat in OpenCV


I have a couple of images in Mat objects all with same dimensions I'd like to create one bix cv::Mat object to hold them all

So the dimension of the new matrix is: widthNew = widthOld x number of matrices, height remains unchanged.

I found that such a copy could be done using:

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

but then, how could the mask be defined three different times for the three matrices?.

Regards, Moataz


Solution

  • You use an roi to define an image which is actually a region of the destination image and then copy to that. see Copy an cv::Mat inside a ROI of another one