Convert from vector<IplImage*> to vector<Mat>



这个操作很麻烦。我打不过去。我错过了什么?

vector<Mat> blobC;
for(unsigned int i = 0; i < blobCFinal.size(); i++)
{
    blobC.at(i) = blobCFinal.at(i);
}

,

vector<IplImage*> blobCFinal;

如果我没弄错的话,通常转换正常类型的方法是这样的,

IplImage* blobCFinal;
Mat blobC(blobCFinal);

答:感谢@rotating_image,可能这将工作

vector<Mat> blobC;
    for(unsigned int i = 0; i < blobCFinal.size(); i++)
    {
        Mat dummy = Mat(blobCFinal[i]);
        blobC.push_back(dummy);
    }

试试这个…

vector<Mat> blobC;
vector<IplImage*> blobCFinal;
//some processing 
for(unsigned int i = 0; i < blobCFinal.size(); i++)
{
    Mat dummy = Mat(blobCFinal[i]);
    blobC[i] = dummy.clone();
}

相关内容

  • 没有找到相关文章

最新更新