是否可以创建和使用MatIterator数组
Is it possible to create and use an array of MatIterators?
示例代码:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/video.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat a = Mat::zeros(4,4,CV_8UC1);
Mat b = Mat::zeros(4,4,CV_8UC1);
MatIterator_<uchar> it[2];
it[0] = a.begin<uchar>;
it[1] = b.begin<uchar>;
}
我目前正在做一个有多个相关图像的项目,在这个项目中,制作一个迭代器数组可以大大简化代码,并使其易于遵循,我更愿意坚持这一点
是否可以使用MatIterator数组?如果是,我该如何正确使用它们。
我有几个其他的解决方案来解决这个问题,比如使用颜色通道将图像集成在一起,然后对所有图像使用一个MatIterator,或者为每个单独的图像创建单独的MatIterater,然后从那里开始。
目前在Ubuntu 12.04的QT最新版本中使用OpenCV 2.4(更新和升级)
谢谢你的帮助。
代表我的错误。上面代码中的所有内容都是正确的,只是我忘了在使用指针后加括号。正确的代码如下:
int main()
{
Mat a = Mat::zeros(4,4,CV_8UC1);
Mat b = Mat::zeros(4,4,CV_8UC1);
MatIterator_<uchar> it[2];
it[0] = a.begin<uchar>(); //<--------- the brackets that I forgot
it[1] = b.begin<uchar>(); //<--------- same here
}
很抱歉犯了这样一个平凡的错误。
相关文章:
- Mongodb c++驱动程序:如何查询元素的数组
- 将数组的地址分配给变量并删除
- 从C++本机插件更新Vector3数组
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 将数组作为参数传递给函数安全吗?作为第三方职能部门,可以探索他们想要的之外的其他元素
- 数组索引的值没有增加
- 将对象数组的引用传递给函数
- 为char数组调整zlib-zpipe
- 2D数组来自文本输入,中间有空格
- std::向量与传递值的动态数组
- 在c++中用vector填充一个简单的动态数组
- 使用strcpy将char数组的元素复制到另一个数组
- 使用指针从C++中的数组中获取最大值
- C++使用整数的压缩数组初始化对象
- 告诉一个 const char 数组,除了编译时 C 样式的字符串外,它不以 '