向量下标超出范围Opencv

时间:2016-04-21 11:55:01

标签: c++ opencv

我试图将elbp函数(即MAT)的输出插入到新的向量中但是我得到:向量下标超出范围错误?有什么建议吗?

vector <Mat> RefPyramids;
vector <Mat> LBPRefPyramids;
buildPyramid(PyramidDummy, RefPyramids, 3);
for (int PyramidIndex = 0; PyramidIndex <= 4; PyramidIndex++ )
{   
    Mat PramidLoopMat = RefPyramids[PyramidIndex];
    Mat LBPLoopMat;
    lbp::ELBP(PramidLoopMat, LBPLoopMat,  radius, neighbors);
    LBPRefPyramids[PyramidIndex] = LBPLoopMat;
}

1 个答案:

答案 0 :(得分:1)

您说(在评论中){​​{1}}的大小为4.但您的代码违反了该条款:

RefPyramids

你看,你正在迭代[0,1,2,3,4]。 for (int PyramidIndex = 0; PyramidIndex <= 4; PyramidIndex++ ) { Mat PramidLoopMat = RefPyramids[PyramidIndex]; 应为<=