class_docstr: Container for all keypoints on a single image.
  
  Parameters
  ----------
  keypoints : list of imgaug.augmentables.kps.Keypoint
      List of keypoints on the image.
  
  shape : tuple of int
      The shape of the image on which the objects are placed, i.e. the
      result of ``image.shape``.
      Should include the number of channels, not only height and width.
  
  Examples
  --------
  >>> import numpy as np
  >>> from imgaug.augmentables.kps import Keypoint, KeypointsOnImage
  >>>
  >>> image = np.zeros((70, 70))
  >>> kps = [Keypoint(x=10, y=20), Keypoint(x=34, y=60)]
  >>> kps_oi = KeypointsOnImage(kps, shape=image.shape)
class_docstr_tok: ["Container","for","all","keypoints","on","a","single","image",".","Parameters","--","--","--","--","--","keypoints",":","list","of","imgaug.augmentables.kps.Keypoint","List","of","keypoints","on","the","image",".","shape",":","tuple","of","int","The","shape","of","the","image","on","which","the","objects","are","placed",",","i.e",".","the","result","of","``","image.shape","``",".","Should","include","the","number","of","channels",",","not","only","height","and","width",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","imgaug.augmentables.kps","import","Keypoint",",","KeypointsOnImage",">",">",">",">",">",">","image","=","np.zeros","(","(","70",",","70",")",")",">",">",">","kps","=","[","Keypoint","(","x=10",",","y=20",")",",","Keypoint","(","x=34",",","y=60",")","]",">",">",">","kps_oi","=","KeypointsOnImage","(","kps",",","shape=image.shape",")"]
docstr: Convert outputs of ``to_distance_maps()`` to ``KeypointsOnImage``.
  
  This is the inverse of :func:`KeypointsOnImage.to_distance_maps`.
  
  Parameters
  ----------
  distance_maps : (H,W,N) ndarray
      The distance maps. ``N`` is the number of keypoints.
  
  inverted : bool, optional
      Whether the given distance maps were generated in inverted mode
      (i.e. :func:`KeypointsOnImage.to_distance_maps` was called with
      ``inverted=True``) or in non-inverted mode.
  
  if_not_found_coords : tuple or list or dict or None, optional
      Coordinates to use for keypoints that cannot be found
      in `distance_maps`.
  
      * If this is a ``list``/``tuple``, it must contain two ``int``
        values.
      * If it is a ``dict``, it must contain the keys ``x`` and
        ``y`` with each containing one ``int`` value.
      * If this is ``None``, then the keypoint will not be added to the
        final :class:`KeypointsOnImage` object.
  
  threshold : float, optional
      The search for keypoints works by searching for the
      argmin (non-inverted) or argmax (inverted) in each channel. This
      parameters contains the maximum (non-inverted) or
      minimum (inverted) value to accept in order to view a hit as a
      keypoint. Use ``None`` to use no min/max.
  
  nb_channels : None or int, optional
      Number of channels of the image on which the keypoints are placed.
      Some keypoint augmenters require that information.
      If set to ``None``, the keypoint's shape will be set
      to ``(height, width)``, otherwise ``(height, width, nb_channels)``.
  
  Returns
  -------
  imgaug.augmentables.kps.KeypointsOnImage
      The extracted keypoints.
docstr_tok: ["Convert","outputs","of","``","to_distance_maps","(",")","``","to","``","KeypointsOnImage","``",".","This","is","the","inverse","of",":","func",":","`","KeypointsOnImage.to_distance_maps","`",".","Parameters","--","--","--","--","--","distance_maps",":","(","H",",","W",",","N",")","ndarray","The","distance","maps",".","``","N","``","is","the","number","of","keypoints",".","inverted",":","bool",",","optional","Whether","the","given","distance","maps","were","generated","in","inverted","mode","(","i.e",".",":","func",":","`","KeypointsOnImage.to_distance_maps","`","was","called","with","``","inverted=True","``",")","or","in","non-inverted","mode",".","if_not_found_coords",":","tuple","or","list","or","dict","or","None",",","optional","Coordinates","to","use","for","keypoints","that","can","not","be","found","in","`","distance_maps","`",".","*","If","this","is","a","``","list","``","\/","``","tuple","``",",","it","must","contain","two","``","int","``","values",".","*","If","it","is","a","``","dict","``",",","it","must","contain","the","keys","``","x","``","and","``","y","``","with","each","containing","one","``","int","``","value",".","*","If","this","is","``","None","``",",","then","the","keypoint","will","not","be","added","to","the","final",":","class",":","`","KeypointsOnImage","`","object",".","threshold",":","float",",","optional","The","search","for","keypoints","works","by","searching","for","the","argmin","(","non-inverted",")","or","argmax","(","inverted",")","in","each","channel",".","This","parameters","contains","the","maximum","(","non-inverted",")","or","minimum","(","inverted",")","value","to","accept","in","order","to","view","a","hit","as","a","keypoint",".","Use","``","None","``","to","use","no","min\/max",".","nb_channels",":","None","or","int",",","optional","Number","of","channels","of","the","image","on","which","the","keypoints","are","placed",".","Some","keypoint","augmenters","require","that","information",".","If","set","to","``","None","``",",","the","keypoint","'s","shape","will","be","set","to","``","(","height",",","width",")","``",",","otherwise","``","(","height",",","width",",","nb_channels",")","``",".","Returns","--","--","--","-","imgaug.augmentables.kps.KeypointsOnImage","The","extracted","keypoints","."]
code: def from_distance_maps(
      distance_maps,
      inverted=False,
      if_not_found_coords={"x": -1, "y": -1},
      threshold=None,
      nb_channels=None,
  ):
      """Convert outputs of ``to_distance_maps()`` to ``KeypointsOnImage``.
  
      This is the inverse of :func:`KeypointsOnImage.to_distance_maps`.
  
      Parameters
      ----------
      distance_maps : (H,W,N) ndarray
          The distance maps. ``N`` is the number of keypoints.
  
      inverted : bool, optional
          Whether the given distance maps were generated in inverted mode
          (i.e. :func:`KeypointsOnImage.to_distance_maps` was called with
          ``inverted=True``) or in non-inverted mode.
  
      if_not_found_coords : tuple or list or dict or None, optional
          Coordinates to use for keypoints that cannot be found
          in `distance_maps`.
  
          * If this is a ``list``/``tuple``, it must contain two ``int``
            values.
          * If it is a ``dict``, it must contain the keys ``x`` and
            ``y`` with each containing one ``int`` value.
          * If this is ``None``, then the keypoint will not be added to the
            final :class:`KeypointsOnImage` object.
  
      threshold : float, optional
          The search for keypoints works by searching for the
          argmin (non-inverted) or argmax (inverted) in each channel. This
          parameters contains the maximum (non-inverted) or
          minimum (inverted) value to accept in order to view a hit as a
          keypoint. Use ``None`` to use no min/max.
  
      nb_channels : None or int, optional
          Number of channels of the image on which the keypoints are placed.
          Some keypoint augmenters require that information.
          If set to ``None``, the keypoint's shape will be set
          to ``(height, width)``, otherwise ``(height, width, nb_channels)``.
  
      Returns
      -------
      imgaug.augmentables.kps.KeypointsOnImage
          The extracted keypoints.
  
      """
      # pylint: disable=dangerous-default-value
      assert distance_maps.ndim == 3, (
          "Expected three-dimensional input, got %d dimensions and "
          "shape %s." % (distance_maps.ndim, distance_maps.shape)
      )
      height, width, nb_keypoints = distance_maps.shape
  
      drop_if_not_found = False
      if if_not_found_coords is None:
          drop_if_not_found = True
          if_not_found_x = -1
          if_not_found_y = -1
      elif isinstance(if_not_found_coords, (tuple, list)):
          assert len(if_not_found_coords) == 2, (
              "Expected tuple/list 'if_not_found_coords' to contain "
              "exactly two entries, got %d."
              % (len(if_not_found_coords),)
          )
          if_not_found_x = if_not_found_coords[0]
          if_not_found_y = if_not_found_coords[1]
      elif isinstance(if_not_found_coords, dict):
          if_not_found_x = if_not_found_coords["x"]
          if_not_found_y = if_not_found_coords["y"]
      else:
          raise Exception(
              "Expected if_not_found_coords to be None or tuple or list or "
              "dict, got %s." % (type(if_not_found_coords),)
          )
  
      keypoints = []
      for i in sm.xrange(nb_keypoints):
          # TODO introduce voting here among all distance values that have
          #      min/max values
          if inverted:
              hitidx_flat = np.argmax(distance_maps[..., i])
          else:
              hitidx_flat = np.argmin(distance_maps[..., i])
          hitidx_ndim = np.unravel_index(hitidx_flat, (height, width))
          if not inverted and threshold is not None:
              found = (
                  distance_maps[hitidx_ndim[0], hitidx_ndim[1], i]
                  < threshold
              )
          elif inverted and threshold is not None:
              found = (
                  distance_maps[hitidx_ndim[0], hitidx_ndim[1], i]
                  >= threshold
              )
          else:
              found = True
          if found:
              keypoints.append(
                  Keypoint(x=hitidx_ndim[1], y=hitidx_ndim[0])
              )
          else:
              if drop_if_not_found:
                  # dont add the keypoint to the result list, i.e. drop it
                  pass
              else:
                  keypoints.append(
                      Keypoint(x=if_not_found_x, y=if_not_found_y)
                  )
  
      out_shape = (height, width)
      if nb_channels is not None:
          out_shape += (nb_channels,)
      return KeypointsOnImage(keypoints, shape=out_shape)
  
imports: from __future__ import print_function, division, absolute_import
  import numpy
  import scipy.spatial.distance
  import six.moves
  from ..None import imgaug
  from .base import IAugmentable
  from .utils import normalize_imglike_shape, project_coords, _remove_out_of_image_fraction_, _handle_on_image_shape
label_desc: Use image node_id 24 for calling the KeypointsOnImage obj's underlying member method code with example usage: obj.from_distance_maps(distance_maps, inverted, if_not_found_coords, threshold, nb_channels) and returns: KeypointsOnImage