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 ``to_keypoint_image()`` outputs to ``KeypointsOnImage``.
  
  This is the inverse of :func:`KeypointsOnImage.to_keypoint_image`.
  
  Parameters
  ----------
  image : (H,W,N) ndarray
      The keypoints image. N is the number of keypoints.
  
  if_not_found_coords : tuple or list or dict or None, optional
      Coordinates to use for keypoints that cannot be found in `image`.
  
      * 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 : int, optional
      The search for keypoints works by searching for the argmax in
      each channel. This parameters contains the minimum value that
      the max must have in order to be viewed as a keypoint.
  
  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","``","to_keypoint_image","(",")","``","outputs","to","``","KeypointsOnImage","``",".","This","is","the","inverse","of",":","func",":","`","KeypointsOnImage.to_keypoint_image","`",".","Parameters","--","--","--","--","--","image",":","(","H",",","W",",","N",")","ndarray","The","keypoints","image",".","N","is","the","number","of","keypoints",".","if_not_found_coords",":","tuple","or","list","or","dict","or","None",",","optional","Coordinates","to","use","for","keypoints","that","can","not","be","found","in","`","image","`",".","*","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",":","int",",","optional","The","search","for","keypoints","works","by","searching","for","the","argmax","in","each","channel",".","This","parameters","contains","the","minimum","value","that","the","max","must","have","in","order","to","be","viewed","as","a","keypoint",".","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_keypoint_image(
      image,
      if_not_found_coords={"x": -1, "y": -1},
      threshold=1,
      nb_channels=None,
  ):
      """Convert ``to_keypoint_image()`` outputs to ``KeypointsOnImage``.
  
      This is the inverse of :func:`KeypointsOnImage.to_keypoint_image`.
  
      Parameters
      ----------
      image : (H,W,N) ndarray
          The keypoints image. N is the number of keypoints.
  
      if_not_found_coords : tuple or list or dict or None, optional
          Coordinates to use for keypoints that cannot be found in `image`.
  
          * 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 : int, optional
          The search for keypoints works by searching for the argmax in
          each channel. This parameters contains the minimum value that
          the max must have in order to be viewed as a keypoint.
  
      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 image.ndim == 3, (
          "Expected 'image' to have three dimensions, "
          "got %d with shape %s instead." % (image.ndim, image.shape)
      )
      height, width, nb_keypoints = image.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 'if_not_found_coords' to contain exactly two "
              "values, got %d values." % (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):
          maxidx_flat = np.argmax(image[..., i])
          maxidx_ndim = np.unravel_index(maxidx_flat, (height, width))
  
          found = image[maxidx_ndim[0], maxidx_ndim[1], i] >= threshold
          if found:
              x = maxidx_ndim[1] + 0.5
              y = maxidx_ndim[0] + 0.5
              keypoints.append(Keypoint(x=x, y=y))
          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 22 for calling the KeypointsOnImage obj's underlying member method code with example usage: obj.from_keypoint_image(image, if_not_found_coords, threshold, nb_channels) and returns: KeypointsOnImage