If I have a mat like
Mat mat = (Mat_<int>(1, 8) << 5, 6, 0, 4, 0, 1, 9, 9);
Of course I can convert mat
into a vector vec
by
vector<int> vec(mat.begin<int>(), mat.end<int>());
But when the mat
have 2 or more channels, how to convert it into a vector<vector<int>>
? I mean if I have such Mat
int vec[4][2] = { {5, 6}, {0, 4}, {0,1}, {9, 9} };
Mat mat(4,1,CV_32SC2,vec);
How to get a vector<vector<int>> vec2{ {5, 6}, {0, 4}, {0,1}, {9, 9} }
?