Mat::rowRange为矩阵的指定行区间创建一个矩阵头。
C++: Mat Mat::rowRange(int startrow, int endrow) const C++: Mat Mat::rowRange(const Range& r) constParameters:
startrow – An inclusive 0-based start index of the row span.// 从0开始的行间距索引endrow – An exclusive 0-based ending index of the row span.//终止索引r – Range structure containing both the start and the end indices.The method makes a new header for the specified row span of the matrix. Similarly to Mat::row() and Mat::col() , this is an O(1) operation.
Mat Test = (Mat_<double>(3,3) << 0,1,2, 3,4,5, 6,7,8); cout << "Total matrix:" << endl; cout << Test << endl; Mat testrow = Test.rowRange(0,1).clone(); cout << "Row range:" << endl; cout << testrow << endl; cout << "Test 1 row:" << endl; cout << Test.row(0) << endl; Mat testcol = Test.colRange(0,1).clone(); cout << "Col range:" << endl; cout << testcol << endl;参考链接:https://blog.csdn.net/sinat_29089097/article/details/75533538
