如何填充矢量图像在OpenCV? C ++ [英] How to fill vector with images in OpenCV? C++
问题描述
我创建了向量 std :: vector< cv :: Mat> main_layers;
放置在类中。载体尚未启动。我还有公共成员 cv :: Mat source;
在构造函数启动列表中启动。现在我有一个副本方法将图像的片段复制到main_layers:
I created vector std::vector<cv::Mat> main_layers;
placed in a class. The vector has not been initiated yet. I have also public member cv::Mat source;
initiated in constructor initiation list. Now I have a copy method to copy segments of the image to main_layers:
void copy(){
Rect roi;
auto primarySegment = main_layers.begin();
for (int c = 0; c< primaryKernelsLoad; c++)
{
if (heightPriority)
{
roi = Rect(0, c, size.width, segment1Size);
source(roi).copyTo(primarySegment);
auto nx = std::next(primarySegment, 2);
}
};
};
这里我有错误:
gaussian.cpp :error C2664:'void cv :: Mat :: copyTo(cv :: OutputArray)const':不能将参数1从'std :: _ Vector_iterator< _Myvec>'转换为'cv :: OutputArray'
在 copyTo 上。我如何从向量中的当前图像获取数组?关于C ++ 98,使用Visual Studio 2010.
Here I have error:
gaussian.cpp(133): error C2664: 'void cv::Mat::copyTo(cv::OutputArray) const' : cannot convert parameter 1 from 'std::_Vector_iterator<_Myvec>' to 'cv::OutputArray'
on line with copyTo. How can I get the array from the current image in vector? With regards to C++98, using Visual Studio 2010.
推荐答案
工作完美
void copy(){
Rect roi;
for (int c = 0; c< primaryKernelsLoad; c++)
{
if (heightPriority)
{
roi = cv::Rect(0, c, size.width, segment1Size);
main_layers.push_back(source(roi));
}
};
};
这篇关于如何填充矢量图像在OpenCV? C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!