c++ - OpenCV mat of mats
问题描述
What is the best way to represent with OpenCV(C++) a mat of mats? At the moment in my code, I use a vector of vector<Mat>
and I need the benefits of using a matrix.
解决方案
仅限于我的搜索,不幸的是,Opencv-C++ 中没有定义这样的东西(python 版本有它)。矢量是你所能得到的。
尽管如果您的所有图像都是灰度并且具有相同的大小,您可以定义一个 n 通道图像并将每个图像放入其中一个通道中,例如:
Mat im1 = Mat::ones(n_row , n_col , CV_8UC1);
Mat im2 = Mat::ones(n_row , n_col , CV_8UC1);
Mat im3 = Mat::ones(n_row , n_col , CV_8UC1);
... // n similar images...
Mat img(n_row , n_col , CV_8UC(n));
vector<Mat> vec;
vec.push_back(im1);
vec.push_back(im2);
vec.push_back(im3);
... // push back all the n images
merge(vec,img);
推荐阅读
- termux - Termux 存储库不再有发布文件
- image - 传单 SVG 覆盖随机模糊
- angularjs - AngularJS + Angular 8 不能一起工作 [混合应用程序]
- ios - Xcode 和 Unity 缺少库“lGoogleUtilities”
- haskell - Haskell 长度和滤波器确定线的凸度或凹度
- apache-camel - 在 activeMQs 嵌入式 Camel 模块中找不到 Camel Zookeeper 组件
- ubuntu - Win10 Guest 无法通过桥接无线网络接口 ping VMWARE 播放器上的 Ubuntu 主机
- javascript - 使用 Javascript,如何解析包含 JSON 字符串的 JSON 字符串?
- javascript - THREE.LoopOnce 不播放动画
- apache-spark - DAG 中的 ExternalRDDScan 是什么?