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.
1 | initial version |
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.
2 | No.2 Revision |
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 < std::min(n_cols, n_rows); i = i + n_rows*n_channels + 1)
{
uchar*p = color.ptr<uchar>(i / 3);
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++)
//{
//}
}
3 | No.3 Revision |
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 < std::min(n_cols, n_rows); 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++)
//{
//}
}