问题
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;
回答1:
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);
来源:https://stackoverflow.com/questions/11179957/merge-multiple-cvmat