@@ -43,9 +43,9 @@ def gray_to_binary(gray: np.ndarray) -> np.ndarray:
4343 return (gray > 127 ) & (gray <= 255 )
4444
4545
46- def neighbours (image : np .ndarray , x : int , y : int ) -> list :
46+ def neighbours (image : np .ndarray , x_coord : int , y_coord : int ) -> list :
4747 """
48- Return 8-neighbours of point (x, y ), in clockwise order
48+ Return 8-neighbours of point (x_coord, y_coord ), in clockwise order
4949
5050 >>> neighbours(
5151 ... np.array(
@@ -84,15 +84,15 @@ def neighbours(image: np.ndarray, x: int, y: int) -> list:
8484 neighbour_points = []
8585
8686 for dx , dy in neighborhood :
87- if 0 <= x + dx < img .shape [0 ] and 0 <= y + dy < img .shape [1 ]:
88- neighbour_points .append (img [x + dx ][y + dy ])
87+ if 0 <= x_coord + dx < img .shape [0 ] and 0 <= y_coord + dy < img .shape [1 ]:
88+ neighbour_points .append (img [x_coord + dx ][y_coord + dy ])
8989 else :
9090 neighbour_points .append (False )
9191
9292 return neighbour_points
9393
9494
95- def is_endpoint (image : np .ndarray , x : int , y : int ) -> bool :
95+ def is_endpoint (image : np .ndarray , x_coord : int , y_coord : int ) -> bool :
9696 """
9797 Check if a pixel is an endpoint based on its 8-neighbors.
9898
@@ -121,7 +121,7 @@ def is_endpoint(image: np.ndarray, x: int, y: int) -> bool:
121121 True
122122 """
123123 img = image
124- return int (sum (neighbours (img , x , y ))) == 1
124+ return int (sum (neighbours (img , x_coord , y_coord ))) == 1
125125
126126
127127def prune_skeletonized_image (
0 commit comments