bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / color / colorlabel / label2rgb
function
skimage.color.colorlabel:label2rgb
source: /dev/scikit-image/src/skimage/color/colorlabel.py :85
Signature
def label2rgb ( label , image = None , colors = None , alpha = 0.3 , bg_label = 0 , bg_color = (0, 0, 0) , image_alpha = 1 , kind = overlay , * , saturation = 0 , channel_axis = -1 ) Summary
Return an RGB image where color-coded labels are painted over the image.
Parameters
label: ndarrayInteger array of labels with the same shape as
image.image: ndarray, optionalImage used as underlay for labels. It should have the same shape as
labels, optionally with an additional RGB (channels) axis. Ifimageis an RGB image, it is converted to grayscale before coloring.colors: list, optionalList of colors. If the number of labels exceeds the number of colors, then the colors are cycled.
alpha: float [0, 1], optionalOpacity of colorized labels. Ignored if image is
None.bg_label: int, optionalLabel that's treated as the background. If
bg_labelis specified,bg_colorisNone, andkindisoverlay, background is not painted by any colors.bg_color: str or array, optionalBackground color. Must be a name in
skimage.color.color_dictor RGB float values between [0, 1].image_alpha: float [0, 1], optionalOpacity of the image.
kind: {'overlay', 'avg'}, optionalThe kind of color image desired. 'overlay' cycles over defined colors and overlays the colored labels over the original image. 'avg' replaces each labeled segment with its average color, for a stained-class or pastel painting appearance.
saturation: float [0, 1], optionalParameter to control the saturation applied to the original image between fully saturated (original RGB,
saturation=1) and fully unsaturated (grayscale,saturation=0). Only applies whenkind='overlay'.channel_axis: int, optionalThis parameter indicates which axis of the output array will correspond to channels. If
imageis provided, this must also match the axis ofimagethat corresponds to channels.
Returns
result: ndarray of float, same shape as `image`The result of blending a cycling colormap (
colors) for each distinct value inlabelwith the image, at a certain alpha value.
Aliases
-
skimage.color.label2rgb