Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MareArts/8ac6696501814a855c4fca65e2bf1b86 to your computer and use it in GitHub Desktop.
Save MareArts/8ac6696501814a855c4fca65e2bf1b86 to your computer and use it in GitHub Desktop.
Extract the value of interest rows and copy that to new Mat using concate.cpp
//using concate
cout << "\ncopy interest rows to new Mat using concate\n";
Mat c;
for (auto it : row_index_interest)
{
if (c.empty())
{
c = a.row(it);
continue;
}else{
//cout << a.row(it) << endl;
vconcat(c, a(Range(it, it+1), Range::all()), c);
/* //or
Mat t;
vconcat(c, a(Range(it, it+1), Range::all()), t);
c = t;
*/
}
}
cout << "\nnew Mat\n";
cout << c << endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment