水平合并cv :: Mat

Tom*_*mer 9 c++ ubuntu opencv

我想合并一些cv::Mat,当我使用mat1.push_back(mat2)它添加mat2mat1垂直结束时,有没有办法水平地这样做?我能想到的唯一另一个选择是将每个选项cv::Mat变成a cv::RotatedRect,旋转它,创建一个新的Mat,合并,以相同的方式最终旋转所有内容,但如果有另一种方式,它听起来毫无意义

And*_*dov 17

看看hconcat和vconcat.

用法:

Mat M1,M2,HM,VM;
// M1 and M2 - source matrices
// HM,VM - results matrices
 ...

 hconcat(M1,M2,HM); // horizontal concatenation
 vconcat(M1,M2,VM); // vertical   concatenation
Run Code Online (Sandbox Code Playgroud)

请注意,这些方法没有记录.