From 8e6990f6968c0885e7d45a9cb58eebec503c6ef6 Mon Sep 17 00:00:00 2001 From: Vighnesh Birodkar Date: Mon, 18 Aug 2014 20:40:09 +0530 Subject: [PATCH] addition inline --- skimage/graph/graph_merge.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/skimage/graph/graph_merge.py b/skimage/graph/graph_merge.py index 22984327..0c3d4026 100644 --- a/skimage/graph/graph_merge.py +++ b/skimage/graph/graph_merge.py @@ -112,13 +112,10 @@ def merge_hierarchical(labels, rag, thresh, in_place=True): # Ensure popped edge is valid, if not, the edge is discarded if valid: - total_color = (rag.node[src]['total color'] + - rag.node[dst]['total color']) - n_pixels = (rag.node[src]['pixel count'] + - rag.node[dst]['pixel count']) - rag.node[dst]['total color'] = total_color - rag.node[dst]['pixel count'] = n_pixels - rag.node[dst]['mean color'] = total_color / n_pixels + rag.node[dst]['total color'] += rag.node[src]['total color'] + rag.node[dst]['pixel count'] += rag.node[src]['pixel count'] + rag.node[dst]['mean color'] = (rag.node[dst]['total color'] / + rag.node[dst]['pixel count']) # Conider a graph with edges # (1, 2) -> 50