本文介紹了合并 cv::Mat 水平的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想合并幾個cv::Mat
,當我使用mat1.push_back(mat2)
時,它會在最后添加mat2
mat1
垂直,有沒有辦法水平做到這一點?我能想到的唯一其他選擇是將每個 cv::Mat
變成一個 cv::RotatedRect
,旋轉它,創建一個新的 Mat
,合并,最后以同樣的方式旋轉所有東西,但如果有另一種方式,這聽起來毫無意義
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
推薦答案
看一看 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
注意,這些方法沒有記錄.
Take care, these methods are not documented.
這篇關于合并 cv::Mat 水平的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!