code: def extract_patch(img, detection, force_square=False, alpha=None):
      """Extracts the patch from the image.
  
      Args:
          img: a numpy image array
          detection: a :class:`fiftyone.core.labels.Detection` defining the
              patch
          force_square (False): whether to minimally manipulate the patch
              bounding box into a square prior to extraction
          alpha (None): an optional expansion/contraction to apply to the patch
              before extracting it, in ``[-1, inf)``. If provided, the length and
              width of the box are expanded (or contracted, when ``alpha < 0``)
              by ``(100 * alpha)%``. For example, set ``alpha = 1.1`` to expand
              the box by 10%, and set ``alpha = 0.9`` to contract the box by 10%
  
      Returns:
          the image patch
      """
      dobj = foue.to_detected_object(detection, extra_attrs=False)
  
      bbox = dobj.bounding_box
      if alpha is not None:
          bbox = bbox.pad_relative(alpha)
  
      return bbox.extract_from(img, force_square=force_square)
  
file_path: fiftyone/fiftyone/utils/patches.py
imports: import cv2
  import fiftyone.core.frame
  import fiftyone.core.labels
  import fiftyone.core.validation
  import fiftyone.utils.eta
  import fiftyone.utils.image
label_desc: Use image node_id 2 for calling a global function with example usage: extract_patch(img, detection, force_square, alpha) and returns: bbox