C++ 是否可以创建和使用一个Matiterator数组?
示例代码:C++ 是否可以创建和使用一个Matiterator数组?,c++,arrays,qt,opencv,C++,Arrays,Qt,Opencv,示例代码: #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 m
#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>;
}
#包括
#包括
#包括
#包括
#包括
使用名称空间cv;
使用名称空间std;
int main()
{
Mat a=Mat::零(4,4,CV_8UC1);
Mat b=Mat::零(4,4,CV_8UC1);
MatIterator_uIt[2];
it[0]=a.begin;
it[1]=b.begin;
}
我目前正在从事一个有多个相关图像的项目,在这个项目中,制作一个迭代器数组可以大大简化代码,并使其易于理解,我更愿意坚持这一点
甚至可以使用一组Matiterator吗?如果是这样,我该如何正确地使用它们呢
对于这个问题,我有一些其他的解决方案,比如使用颜色通道将图像整合在一起,然后使用一个MatIterator进行处理,或者为每个单独的图像创建单独的MatIterator并从那里开始
目前在Ubuntu12.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
}
intmain()
{
Mat a=Mat::零(4,4,CV_8UC1);
Mat b=Mat::零(4,4,CV_8UC1);
MatIterator_uIt[2];
it[0]=a.begin()//