Merge multiple cv::Mat?

故事扮演 提交于 2019-12-04 20:48:47

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!