mat.reshape giving me an offset in result [closed]
Hi,
I have been struggling with the reshape function. I have a big matrix that I convert into a 1 column mat. When I convert the I column back to the original size, the image has an offset and doesn't fit the original no more.
Here my code more or less (PS. I have simplified it to this that demonstrates my problem):
vb.net code:
frame = my_Original_mat
Dim SingleColumn As Mat = frame.Clone.Reshape(0, frame.Cols * frame.Rows) 'makes it a 1 column mat
Dim Mymat As New Mat
SingleColumn.Col(0).CopyTo(Mymat) 'get the single column back out again
Dim OriginalShape As Mat = Mymat.Reshape(0, frame.Rows))
CvInvoke.Imshow("Original ", frame.Clone)
CvInvoke.Imshow("OriginalShape ", OriginalShape .Clone)
Sorry for the bad images...but I think you can see that the reshaped one is now shifted down. What am I doing wrong? I need a way to simply extract 1 column at the time from a build up matrix (I concat into this matrix). Let me know if anything else is needed and thanks for the help in advance.
sorry, but we can't help with vb or any 3rdparty wrappers.
@TheoDup. What, if you change this
frame.Clone.Reshape(0, frame.Cols * frame.Rows)
toframe.Clone.Reshape(1, frame.Cols * frame.Rows)
?@supra56, thanks for the idea and reply/help. However, changing the 0 to 1 will chance the color depth according to the documentation (with 1 = probably gray scale then?). Also, I posted my probleem on emgu wrapper and was also told this is the wrong place (sorry for this). I have in the mean time found out now that the problem is only with column 0. If I take any other column it works as expected. Only column 0 has this kind of offset.