访问多 channel 矩阵的第 i 行 channel::n 的语法是什么。我可以访问 channel::n 的 (i,j) 元素,但是使用 row、rowRange 等函数的语法是什么......
示例代码:
Mat M(10, 3, CV_32SC3);
cout << M.at<Vec3d>(0,0)[1] << endl; // This works
cout << M.row(0)[1] << endl; // Syntax of this
最佳答案
Mat.row(0) returns a Mat, so it's the same game as before:
// if it's really INT 3channels(like your ex. above), you have to use m.at<Vec3i> !!
Mat M(10, 3, CV_32SC3);
// 3rd row
Mat r = m.row(3);
// r has only 1 row (3 elems), last pixel there
cout<< r.at<Vec3i>(0,2)[0];
关于c++ - 在 OpenCV Mat 中访问多个 channel ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14954016/