I am a beginnner in opencv. I am trying to reshape a matrix but it doesn't seem to work.
Mat image=imread("xyz.png",1);
cout<<image.size()<<endl;
cout<<image.rows<<"x"<<image.cols<<endl;
Why are these two outputs different?
From the cv documentation:
The method returns a matrix size: Size(cols, rows) . When the matrix is more than 2-dimensional, the returned size is (-1, -1).
Thus when you print the size you get cols x rows
and in your second cout
you get rows x cols
.
From the OpenCV documentation:
So in the first case you are printing cols x rows and in the second case rows x cols.