code: def binary_erosion(image, footprint=None, out=None, *, mode="ignore"):
      """Return fast binary morphological erosion of an image.
  
      This function returns the same result as grayscale erosion but performs
      faster for binary images.
  
      Morphological erosion sets a pixel at ``(i,j)`` to the minimum over all
      pixels in the neighborhood centered at ``(i,j)``. Erosion shrinks bright
      regions and enlarges dark regions.
  
      Parameters
      ----------
      image : ndarray
          Binary input image.
      footprint : ndarray or tuple, optional
          The neighborhood expressed as a 2-D array of 1's and 0's.
          If None, use a cross-shaped footprint (connectivity=1). The footprint
          can also be provided as a sequence of smaller footprints as described
          in the notes below.
      out : ndarray of bool, optional
          The array to store the result of the morphology. If None is
          passed, a new array will be allocated.
      mode : str, optional
          The `mode` parameter determines how the array borders are handled.
          Valid modes are: 'max', 'min', 'ignore'.
          If 'max' or 'ignore', pixels outside the image domain are assumed
          to be `True`, which causes them to not influence the result.
          Default is 'ignore'.
  
          .. versionadded:: 0.23
              `mode` was added in 0.23.
  
      Returns
      -------
      eroded : ndarray of bool or uint
          The result of the morphological erosion taking values in
          ``[False, True]``.
  
      Notes
      -----
      The footprint can also be a provided as a sequence of 2-tuples where the
      first element of each 2-tuple is a footprint ndarray and the second element
      is an integer describing the number of times it should be iterated. For
      example ``footprint=[(np.ones((9, 1)), 1), (np.ones((1, 9)), 1)]``
      would apply a 9x1 footprint followed by a 1x9 footprint resulting in a net
      effect that is the same as ``footprint=np.ones((9, 9))``, but with lower
      computational cost. Most of the builtin footprints such as
      :func:`skimage.morphology.disk` provide an option to automatically generate a
      footprint sequence of this type.
  
      For even-sized footprints, :func:`skimage.morphology.erosion` and
      this function produce an output that differs: one is shifted by one pixel
      compared to the other.
  
      See also
      --------
      skimage.morphology.isotropic_erosion
  
      """
      if out is None:
          out = np.empty(image.shape, dtype=bool)
  
      if mode not in {"max", "min", "ignore"}:
          raise ValueError(f"unsupported mode, got {mode!r}")
      border_value = False if mode == "min" else True
  
      footprint = pad_footprint(footprint, pad_end=True)
      if not _footprint_is_sequence(footprint):
          footprint = [(footprint, 1)]
  
      out = _iterate_binary_func(
          binary_func=ndi.binary_erosion,
          image=image,
          footprint=footprint,
          out=out,
          border_value=border_value,
      )
      return out
  
file_path: scikit-image/skimage/morphology/binary.py
imports: import numpy
  from scipy import ndimage
  from .footprints import _footprint_is_sequence, pad_footprint
  from .misc import default_footprint
label_desc: Use image node_id 2 for calling a global function with example usage: binary_erosion(image, footprint, out) and returns: out