Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to merge a few cv::Mat, when I use mat1.push_back(mat2) it add mat2 to the end of mat1 vertically , is there a way to do this horizontally? The only other option I can think of is making every cv::Mat into a cv::RotatedRect, rotate it, creating a new Mat, merging, rotating everything in the end in the same way, but it sound pointlessly long if there is another way

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
184 views
Welcome To Ask or Share your Answers For Others

1 Answer

Take a look at hconcat and vconcat.

usage:

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

Take care, these methods are not documented.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...