code: def rgb2gray(rgb, *, channel_axis=-1):
      """Compute luminance of an RGB image.
  
      Parameters
      ----------
      rgb : (..., C=3, ...) array_like
          The image in RGB format. By default, the final dimension denotes
          channels.
  
      Returns
      -------
      out : ndarray
          The luminance image - an array which is the same size as the input
          array, but with the channel dimension removed.
  
      Raises
      ------
      ValueError
          If `rgb` is not at least 2-D with shape (..., C=3, ...).
  
      Notes
      -----
      The weights used in this conversion are calibrated for contemporary
      CRT phosphors::
  
          Y = 0.2125 R + 0.7154 G + 0.0721 B
  
      If there is an alpha channel present, it is ignored.
  
      References
      ----------
      .. [1] http://poynton.ca/PDFs/ColorFAQ.pdf
  
      Examples
      --------
      >>> from skimage.color import rgb2gray
      >>> from skimage import data
      >>> img = data.astronaut()
      >>> img_gray = rgb2gray(img)
      """
      rgb = _prepare_colorarray(rgb)
      coeffs = np.array([0.2125, 0.7154, 0.0721], dtype=rgb.dtype)
      return rgb @ coeffs
  
imports: from warnings import warn
  import numpy
  from scipy import linalg
  from .._shared.utils import _supported_float_type, channel_as_last_axis, identity, reshape_nd, slice_at_axis
  from ..util import dtype, dtype_limits
label_desc: Use image node_id 13 for calling a global function with example usage: rgb2gray(rgb) and returns: unknown