Matlab 如何解释以下8个邻居

Matlab 如何解释以下8个邻居,matlab,connected-components,Matlab,Connected Components,我想找8个邻居。在一个算法中,它被写成 int Nx[] = {-1, 1, 0, 0, -1, -1, 1, 1}; //8-neighbors int Ny[] = {0, 0, -1, 1, 1, -1, 1, -1}; 3*3矩阵是如何这样解释的?这些是相对的x坐标和y坐标。如果将其转换为坐标对,则更清晰: x y neighbour ---------------------- -1 0 left 1 0 right 0 -1 bott

我想找8个邻居。在一个算法中,它被写成

int Nx[] = {-1, 1, 0, 0, -1, -1, 1,  1}; //8-neighbors
int Ny[] = {0, 0, -1, 1,  1, -1, 1, -1};

3*3矩阵是如何这样解释的?

这些是相对的x坐标和y坐标。如果将其转换为坐标对,则更清晰:

 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

这是什么意思?你指的是什么样的算法?在摩尔邻域的实现中