mpl_interactions.image_segmenter

class image_segmenter(img, nclasses=1, mask=None, mask_colors=None, mask_alpha=0.75, lineprops=None, figsize=(10, 10), **kwargs)[source]

Bases: object

Manually segment an image with the lasso selector.

__init__(img, nclasses=1, mask=None, mask_colors=None, mask_alpha=0.75, lineprops=None, figsize=(10, 10), **kwargs)[source]

Create an image segmenter. Any kwargs will be passed through to the imshow call that displays img.

Parameters
  • img (array_like) – A valid argument to imshow

  • nclasses (int, default 1)

  • mask (arraylike, optional) – If you want to pre-seed the mask

  • mask_colors (None, color, or array of colors, optional) – the colors to use for each class. Unselected regions will always be totally transparent

  • mask_alpha (float, default .75) – The alpha values to use for selected regions. This will always override the alpha values in mask_colors if any were passed

  • lineprops (dict, default: None) – lineprops passed to LassoSelector. If None the default values are: {“color”: “black”, “linewidth”: 1, “alpha”: 0.8}

  • figsize ((float, float), optional) – passed to plt.figure

  • **kwargs – All other kwargs will passed to the imshow command for the image

Methods

__init__(img[, nclasses, mask, mask_colors, …])

Create an image segmenter.