1 | initial version |
IPP (Intel Performance Primitives) library that was used as base of OpenCV project (that was started by Intel) performs much better when size of the object is multiple of 4 (or some other degree of 2). So in order to achieve better performance each row was 'padded' with few bytes. That was the original reason for introducing widthStep that is different from width. widthStep was not used for definition of ROI. ROI was one of the fields in IplImage object, but it was ignored by some algorithms, and this was reason for many bugs.
OpenCV 2 does not need this padding because it is not based on IPP anymore (well almost). But widthStep parameter was not removed. It is very simple to define ROI in image when width is not equal widthStep. Actually this way is much better than having ROI argument because algorithms that work with Mat don't need to check whether ROI is defined or not. And they can't ignore it. So ROI argument was removed, and widthStep argument remained. It is not used for padding anymore so 'step' equal 'width*channels'.