i would like to find 8 neighbors. In an algorithm it is written as
int Nx[] = {-1, 1, 0, 0, -1, -1, 1, 1}; //8-neighbors
int Ny[] = {0, 0, -1, 1, 1, -1, 1, -1};
how 3*3 matrix is interpreted like this?
i would like to find 8 neighbors. In an algorithm it is written as
int Nx[] = {-1, 1, 0, 0, -1, -1, 1, 1}; //8-neighbors
int Ny[] = {0, 0, -1, 1, 1, -1, 1, -1};
how 3*3 matrix is interpreted like this?
These are relative x- and y- coordinates. It becomes clearer if you convert this to coordinate pairs:
x y neighbour
----------------------
-1 0 left
1 0 right
0 -1 bottom
0 1 top
-1 1 left-top
-1 -1 left-bottom
1 1 right-top
1 -1 right-bottom