OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 21 May 2013 16:12:03 -0500Reshaping matrices into column vectors??http://answers.opencv.org/question/13658/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 reshapeTue, 21 May 2013 16:04:40 -0500http://answers.opencv.org/question/13658/reshaping-matrices-into-column-vectors/Comment by berak for <p>Hi,</p>
<p>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. </p>
<p>I tried using the reshape function as M1.reshape(0,9) but it returns:</p>
<p>OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape</p>
http://answers.opencv.org/question/13658/reshaping-matrices-into-column-vectors/?comment=13659#post-id-13659where/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 simpleTue, 21 May 2013 16:12:03 -0500http://answers.opencv.org/question/13658/reshaping-matrices-into-column-vectors/?comment=13659#post-id-13659