I know that, the data contained in an opencv matrix is not guaranteed to be continuous. To make myself clear, here is a paragraph from Opencv documentation:
When you create a Mat with Mat::create, it is continuous. Such operation like explicitly Mat::create, or implicitly Mat::clone, Mat::Mat(...).
Mat
Mat::create
Mat::clone
Mat::Mat(...)