# Reshaping matrices into column vectors??

Hi,

I have a question regarding reshaping matrices. I have two square 3x3 matrices M1 and M2. I wish to turn both matrices into 9 element column vectors c1 and c2. Next i would like to create a new matrix consisting of new 2x9 matrix [c1,c2]. I need to do this in order to solve a least square problem.

I tried using the reshape function as M1.reshape(0,9) but it returns:

OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape

where/how do you get the original Mat's ?

there's nothing wrong with M1.reshape(0,9) ,

but "OpenCV Error: Image step is wrong" seems to hint, that your input is not so simple