cv::Mat mat { {3, 3, 3}, CV_8UC3};
auto mat2 = mat.clone();
To have two copies of the same matrix, but mat2.rows != mat.rows`, looks like data has been correctly copied, but all metadata doesn’t, which is the correct way to copy a matrix into an other new one (with out sharing data, acutally copying it).