class_docstr: Object representing a segmentation map associated with an image.
  
  Attributes
  ----------
  DEFAULT_SEGMENT_COLORS : list of tuple of int
      Standard RGB colors to use during drawing, ordered by class index.
  
  Parameters
  ----------
  arr : (H,W) ndarray or (H,W,C) ndarray
      Array representing the segmentation map(s). May have dtypes bool,
      int or uint.
  
  shape : tuple of int
      Shape of the image on which the segmentation map(s) is/are placed.
      **Not** the shape of the segmentation map(s) array, unless it is
      identical to the image shape (note the likely difference between the
      arrays in the number of channels).
      This is expected to be ``(H, W)`` or ``(H, W, C)`` with ``C`` usually
      being ``3``.
      If there is no corresponding image, use ``(H_arr, W_arr)`` instead,
      where ``H_arr`` is the height of the segmentation map(s) array
      (analogous ``W_arr``).
  
  nb_classes : None or int, optional
      Deprecated.
class_docstr_tok: ["Object","representing","a","segmentation","map","associated","with","an","image",".","Attributes","--","--","--","--","--","DEFAULT_SEGMENT_COLORS",":","list","of","tuple","of","int","Standard","RGB","colors","to","use","during","drawing",",","ordered","by","class","index",".","Parameters","--","--","--","--","--","arr",":","(","H",",","W",")","ndarray","or","(","H",",","W",",","C",")","ndarray","Array","representing","the","segmentation","map","(","s",")",".","May","have","dtypes","bool",",","int","or","uint",".","shape",":","tuple","of","int","Shape","of","the","image","on","which","the","segmentation","map","(","s",")","is\/are","placed",".","*","*","Not","*","*","the","shape","of","the","segmentation","map","(","s",")","array",",","unless","it","is","identical","to","the","image","shape","(","note","the","likely","difference","between","the","arrays","in","the","number","of","channels",")",".","This","is","expected","to","be","``","(","H",",","W",")","``","or","``","(","H",",","W",",","C",")","``","with","``","C","``","usually","being","``","3","``",".","If","there","is","no","corresponding","image",",","use","``","(","H_arr",",","W_arr",")","``","instead",",","where","``","H_arr","``","is","the","height","of","the","segmentation","map","(","s",")","array","(","analogous","``","W_arr","``",")",".","nb_classes",":","None","or","int",",","optional","Deprecated","."]
docstr: Draw the segmentation map as an overlay over an image.
  
  Parameters
  ----------
  image : (H,W,3) ndarray
      Image onto which to draw the segmentation map. Expected dtype
      is ``uint8``.
  
  alpha : float, optional
      Alpha/opacity value to use for the mixing of image and
      segmentation map. Larger values mean that the segmentation map
      will be more visible and the image less visible.
  
  resize : {'segmentation_map', 'image'}, optional
      In case of size differences between the image and segmentation
      map, either the image or the segmentation map can be resized.
      This parameter controls which of the two will be resized to the
      other's size.
  
  colors : None or list of tuple of int, optional
      Colors to use. One for each class to draw.
      If ``None``, then default colors will be used.
  
  draw_background : bool, optional
      If ``True``, the background will be drawn like any other class.
      If ``False``, the background will not be drawn, i.e. the respective
      background pixels will be identical with the image's RGB color at
      the corresponding spatial location and no color overlay will be
      applied.
  
  background_class_id : int, optional
      Class id to interpret as the background class.
      See `draw_background`.
  
  background_threshold : None, optional
      Deprecated.
      This parameter is ignored.
  
  Returns
  -------
  list of (H,W,3) ndarray
      Rendered overlays as ``uint8`` arrays.
      Always a **list** containing one RGB image per segmentation map
      array channel.
docstr_tok: ["Draw","the","segmentation","map","as","an","overlay","over","an","image",".","Parameters","--","--","--","--","--","image",":","(","H",",","W,3",")","ndarray","Image","onto","which","to","draw","the","segmentation","map",".","Expected","dtype","is","``","uint8","``",".","alpha",":","float",",","optional","Alpha\/opacity","value","to","use","for","the","mixing","of","image","and","segmentation","map",".","Larger","values","mean","that","the","segmentation","map","will","be","more","visible","and","the","image","less","visible",".","resize",":","{","'segmentation_map","'",",","'image","'","}",",","optional","In","case","of","size","differences","between","the","image","and","segmentation","map",",","either","the","image","or","the","segmentation","map","can","be","resized",".","This","parameter","controls","which","of","the","two","will","be","resized","to","the","other","'s","size",".","colors",":","None","or","list","of","tuple","of","int",",","optional","Colors","to","use",".","One","for","each","class","to","draw",".","If","``","None","``",",","then","default","colors","will","be","used",".","draw_background",":","bool",",","optional","If","``","True","``",",","the","background","will","be","drawn","like","any","other","class",".","If","``","False","``",",","the","background","will","not","be","drawn",",","i.e",".","the","respective","background","pixels","will","be","identical","with","the","image","'s","RGB","color","at","the","corresponding","spatial","location","and","no","color","overlay","will","be","applied",".","background_class_id",":","int",",","optional","Class","id","to","interpret","as","the","background","class",".","See","`","draw_background","`",".","background_threshold",":","None",",","optional","Deprecated",".","This","parameter","is","ignored",".","Returns","--","--","--","-","list","of","(","H",",","W,3",")","ndarray","Rendered","overlays","as","``","uint8","``","arrays",".","Always","a","*","*","list","*","*","containing","one","RGB","image","per","segmentation","map","array","channel","."]
code: def draw_on_image(
      self,
      image,
      alpha=0.75,
      resize="segmentation_map",
      colors=None,
      draw_background=False,
      background_class_id=0,
      background_threshold=None,
  ):
      """Draw the segmentation map as an overlay over an image.
  
      Parameters
      ----------
      image : (H,W,3) ndarray
          Image onto which to draw the segmentation map. Expected dtype
          is ``uint8``.
  
      alpha : float, optional
          Alpha/opacity value to use for the mixing of image and
          segmentation map. Larger values mean that the segmentation map
          will be more visible and the image less visible.
  
      resize : {'segmentation_map', 'image'}, optional
          In case of size differences between the image and segmentation
          map, either the image or the segmentation map can be resized.
          This parameter controls which of the two will be resized to the
          other's size.
  
      colors : None or list of tuple of int, optional
          Colors to use. One for each class to draw.
          If ``None``, then default colors will be used.
  
      draw_background : bool, optional
          If ``True``, the background will be drawn like any other class.
          If ``False``, the background will not be drawn, i.e. the respective
          background pixels will be identical with the image's RGB color at
          the corresponding spatial location and no color overlay will be
          applied.
  
      background_class_id : int, optional
          Class id to interpret as the background class.
          See `draw_background`.
  
      background_threshold : None, optional
          Deprecated.
          This parameter is ignored.
  
      Returns
      -------
      list of (H,W,3) ndarray
          Rendered overlays as ``uint8`` arrays.
          Always a **list** containing one RGB image per segmentation map
          array channel.
  
      """
      if background_threshold is not None:
          ia.warn_deprecated(
              "The argument `background_threshold` is deprecated and "
              "ignored. Please don't use it anymore."
          )
  
      assert image.ndim == 3, (
          "Expected to draw on 3-dimensional image, got image with %d "
          "dimensions." % (image.ndim,)
      )
      assert image.shape[2] == 3, (
          "Expected to draw on RGB image, got image with %d channels "
          "instead." % (image.shape[2],)
      )
      assert (
          image.dtype.name == "uint8"
      ), "Expected to get image with dtype uint8, got dtype %s." % (
          image.dtype.name,
      )
      assert (
          0 - 1e-8 <= alpha <= 1.0 + 1e-8
      ), "Expected 'alpha' to be in interval [0.0, 1.0], got %.4f." % (
          alpha,
      )
      assert resize in ["segmentation_map", "image"], (
          'Expected \'resize\' to be "segmentation_map" or "image", got '
          "%s." % (resize,)
      )
  
      colors = (
          colors
          if colors is not None
          else SegmentationMapsOnImage.DEFAULT_SEGMENT_COLORS
      )
  
      if resize == "image":
          image = ia.imresize_single_image(
              image, self.arr.shape[0:2], interpolation="cubic"
          )
  
      segmaps_drawn = []
      arr_channelwise = np.dsplit(self.arr, self.arr.shape[2])
      for arr in arr_channelwise:
          arr = arr[:, :, 0]
  
          nb_classes = 1 + np.max(arr)
          segmap_drawn = np.zeros(
              (arr.shape[0], arr.shape[1], 3), dtype=np.uint8
          )
          assert nb_classes <= len(colors), (
              "Can't draw all %d classes as it would exceed the maximum "
              "number of %d available colors."
              % (
                  nb_classes,
                  len(colors),
              )
          )
  
          ids_in_map = np.unique(arr)
          for c, color in zip(sm.xrange(nb_classes), colors):
              if c in ids_in_map:
                  class_mask = arr == c
                  segmap_drawn[class_mask] = color
  
          segmap_drawn = ia.imresize_single_image(
              segmap_drawn, image.shape[0:2], interpolation="nearest"
          )
  
          segmap_on_image = blendlib.blend_alpha(
              segmap_drawn, image, alpha
          )
  
          if draw_background:
              mix = segmap_on_image
          else:
              foreground_mask = ia.imresize_single_image(
                  (arr != background_class_id),
                  image.shape[0:2],
                  interpolation="nearest",
              )
              # without this, the merge below does nothing
              foreground_mask = np.atleast_3d(foreground_mask)
  
              mix = (
                  ~foreground_mask
              ) * image + foreground_mask * segmap_on_image
          segmaps_drawn.append(mix)
      return segmaps_drawn
  
imports: from __future__ import print_function, division, absolute_import
  import numpy
  import six.moves
  from ..None import imgaug
  from ..augmenters import blend
  from .base import IAugmentable
label_desc: Use image node_id 5 for calling the SegmentationMapsOnImage obj's underlying member method code with example usage: obj.draw_on_image(image, alpha, resize, colors, draw_background, background_class_id, background_threshold) and returns: segmaps_drawn