skimage2.color.label2rgb#
- skimage2.color.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)[source]#
Return an RGB image where color-coded labels are painted over the image.
- Parameters:
- labelndarray
Integer array of labels with the same shape as
image.- imagendarray, optional
Image 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.- colorslist, optional
List of colors. If the number of labels exceeds the number of colors, then the colors are cycled.
- alphafloat [0, 1], optional
Opacity of colorized labels. Ignored if image is
None.- bg_labelint, optional
Label that’s treated as the background. If
bg_labelis specified,bg_colorisNone, andkindisoverlay, background is not painted by any colors.- bg_colorstr or array, optional
Background color. Must be a name in
skimage.color.color_dictor RGB float values between [0, 1].- image_alphafloat [0, 1], optional
Opacity of the image.
- kind{‘overlay’, ‘avg’}, optional
The 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.
- saturationfloat [0, 1], optional
Parameter 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_axisint, optional
This 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.Added in version 0.19:
channel_axiswas added in 0.19.
- Returns:
- resultndarray 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.
- resultndarray of float, same shape as