how to efficiently scan matrix this way ?
For each point, I scan the right and bottom all the way down, then I move diagonally and continue. It is extremely difficult to do this with pointer access. I was wondering if anyone has any suggestion.
//diagonal scan
for (int i = 0; i < n_cols * n_rows * n_channels; i = i + n_rows*n_channels + 1)
{
//pointer to color mat (cv::Vec3b)
uchar*p = color.ptr<uchar>(i / 3);
//pointer to label mat (int)
int* l = label.ptr<int>(i / 3);
cout << l[0] << " "; cin.get();
////right scan
//for (int j = 0; j < n_cols - i; j++)
//{
//}
////bottom scan
//for (int j = 0; j < n_rows - i; j++)
//{
//}
}