indentation correction

This commit is contained in:
Vighnesh Birodkar
2016-01-06 15:06:18 -05:00
committed by Vighnesh Birodkar
parent 3cf6c8b1ce
commit caba3041d1
3 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ This example demonstrates construction of region boundary based RAGs with the
"""
from skimage.future import graph
from skimage import data, segmentation, color, filters, io
from matplotlib import pyplot as plt, colors
from matplotlib import pyplot as colors
img = data.coffee()
gimg = color.rgb2gray(img)
+3 -4
View File
@@ -349,8 +349,7 @@ def rag_boundary(labels, edge_map, connectivity=2):
nbr_indices = list(np.ndindex(*[2]*labels.ndim))
del nbr_indices[0]
nbr_indices_arr = ([idx for idx in nbr_indices if np.linalg.norm(idx)
<= connectivity])
<= connectivity])
iter_shape = tuple(np.array(labels.shape) - 1)
@@ -358,14 +357,14 @@ def rag_boundary(labels, edge_map, connectivity=2):
index_arr = np.array(index)
current = labels[index]
graph.add_node(current, {'labels':[current]})
graph.add_node(current, {'labels': [current]})
for nbr_index in nbr_indices_arr:
adjacent_idx = tuple(index_arr + nbr_index)
adjacent = labels[adjacent_idx]
if current==adjacent:
if current == adjacent:
continue
if graph.has_edge(current, adjacent):
+2 -2
View File
@@ -202,8 +202,8 @@ def test_rag_boundary():
labels = np.zeros((16, 16), dtype='uint8')
edge_map = np.zeros_like(labels, dtype=float)
edge_map[8,:] = 0.5
edge_map[:,8] = 1.0
edge_map[8, :] = 0.5
edge_map[:, 8] = 1.0
labels[:8, :8] = 1
labels[:8, 8:] = 2