从vector <iplimage *>转换为vector <mat> </mat> </iplimage *>

时间:2013-01-19 06:33:46

标签: opencv

我对此操作感到不安。我无法理解。我在哪里错过了?

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);

Ans:感谢@rotating_image,可能会有效

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

1 个答案:

答案 0 :(得分:1)

试试这个......

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();
}