Conversion of 2D cvMat to 1D
Use matrix.reshape((-1, 1)) to turn the n-element 1D matrix into an n-by-1 2D one before converting it.
How can I convert 2D cvMat to 1D? I have tried converting 2D cvMat to Numpy array then used ravel() (I want that kind of resultant matrix).When I tried converting it back to
 cvMat using cv.fromarray() it gives an error that the matrix must be 2D or 3D.