Merge multiple cv::Mat?
Asked Answered
S

1

8

Basically I have 3 mat like this:

Mat descriptors1
Mat descriptors2
Mat descriptors3

Where each descriptors have been loaded like this:

extractor->compute( object, kp, descriptors );

How could I join in a single Mat all the descriptors (append one mat to the other) ?

Example:

Mat fullDesc = descriptors1 + descriptors2 + descriptors3;
Secco answered 24/6, 2012 at 18:9 Comment(0)
U
15

Not very effective, but short:

descriptors1.push_back(descriptors2);
descriptors1.push_back(descriptors3);

After that descriptors1 will be a concatenation.


Also there is an undocumented function vconcat:

void vconcat(const Mat* src, size_t nsrc, OutputArray dst);
void vconcat(InputArray src1, InputArray src2, OutputArray dst);
void vconcat(InputArrayOfArrays src, OutputArray dst);
Unfledged answered 24/6, 2012 at 18:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.