Hi,
I am trying to understand why row and column cv::Mat objects have different outputs for when step1() is invoked. For Example, if I declare matrices and do the following:
cv::Mat rowMatrix(cv::Mat::ones(1,4,CV_8UC1)); // 1x4 matrix
cv::Mat columnMatrix(cv::Mat::ones(4,1,CV_8UC1)); //4x1 matrix
// knowing beforehand that the matrices have continous data
rowMatrix.step1() // outputs 4
columnMatrix.step1() // outputs 1
I got this problem when I was iterating through elements of my row matrix and tried to do some manipulation operation. I got an exception which was not supposed to happen. But that is when I found the disparity between my expected and received value of rowMatrix.step1(). I wonder why it was like that. If I was to do this:
rowMatrix = cv::Mat(rowMatrix.t().col(0));
rowMatrix.step1();
It reveals 1 which is what I wanted originally. Could anyone explain how this is working? Because the manual seems to be saying something different here http://docs.opencv.org/2.4.3rc/modules/core/doc/basic_structures.html#mat-step1
I will try and find the source code and walk through it! But in case anyone has better understanding of it, please suggest an explanation.