So I really dont't get what Vec4b does.
As can be seen from OpenCV's API, it's defined as follows:
template<typename _Tp, int n> class Vec : public Matx<_Tp, n, 1> {...};
...
typedef Vec<uchar, 4> Vec4b;
In other words, it contains 4 uchar
(unsigned char
) values. The Vec
class is commonly used to describe pixel types of multi-channel arrays, e.g. CV_RGBA
.
Also the mMat.ptr.
Mat::ptr()
returns a pointer to the specified matrix row.
So, for your code,
Vec4b *rv = mMat.ptr<Vec4b> (50);
After this, rv
will be a pointer with type Vec4b
that pointers to the 51
-th row of Mat mMat
.
Edit: As all Mat
's data are continuous, after all pixels of current row, e.g. using big index in rv[index]
(for index >= mMat.cols
), you will get data from other rows.