CvMat执行CvReshape()报错“The matrix is not continuous, thus its number of rows can not be changed”

CvMat执行CvReshape()报错“The matrix is not continuous, thus its number of rows can not be changed”,采用如下处理方式:

       重新生成一个全新的矩阵,具有相同的数据,那么数据就是连续的,就能执行reshape()函数操作。

Mat patchMatTmp;
patchMat.copyTo(patchMatTmp);

patchColMat = patchMatTmp.reshape(1,nWindow*nWindow);


你可能感兴趣的:(Matrix)