/* Changes a shape of multi-dimensional array.
new_cn == 0 means that number of channels remains unchanged.
new_dims == 0 means that number and sizes of dimensions remain the same
(unless they need to be changed to set the new number of channels)
if new_dims == 1, there is no need to specify new dimension sizes
The resultant configuration should be achievable w/o data copying.
If the resultant array is sparse, CvSparseMat header should be passed
to the functionelseif the result is 1or2 dimensional,
CvMat header should be passed to the functionelse CvMatND header should be passed */
CvMat* mat_a = cvCreateMat(1, HEIGHT*WIDTH, CV_8U); //单行矩阵便于赋值操作
CvMat* mat_b = cvCreateMat(1, HEIGHT*WIDTH, CV_8U); //同上
cvReshape(mat_a, mat_a, 0, HEIGHT); //把单行矩阵整形为二维矩阵
cvReshape(mat_b, mat_b, 0, HEIGHT);
cvReshape用法详解修改矩阵的形状下面的代码是将单行的矩阵转变成二维矩阵/* Changes a shape of multi-dimensional array. new_cn == 0 means that number of channels remains unchanged. new_dims == 0 means that number and sizes of dim