From d72163a0379dff0d1d7d39d2536a969f9189d4f0 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Wed, 18 Jun 2014 16:46:15 +1000 Subject: [PATCH] Add docstring for _label2rgb_avg --- skimage/color/colorlabel.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/skimage/color/colorlabel.py b/skimage/color/colorlabel.py index 8074c2a3..f76eeebb 100644 --- a/skimage/color/colorlabel.py +++ b/skimage/color/colorlabel.py @@ -157,6 +157,24 @@ def _label2rgb_overlay(label, image=None, colors=None, alpha=0.3, def _label2rgb_avg(label_field, image, bg_label, bg_color): + """Visualise each segment in `label_field` with its mean color in `image`. + + Parameters + ---------- + label_field : array of int + A segmentation of an image. + image : array, shape ``label_field.shape + (3,)`` + A color image of the same spatial shape as `label_field`. + bg_label : int, optional + A value in `label_field` to be treated as background. + bg_color : 3-tuple of int, optional + The color for the background label + + Returns + ------- + out : array, same shape and type as `image` + The output visualization. + """ out = np.zeros_like(image) labels = np.unique(label_field) bg = (labels == bg_label)