code: def rotate_abs_geoms(
      geoms: np.ndarray,
      angle: float,
      img_shape: Tuple[int, int],
      expand: bool = True,
  ) -> np.ndarray:
      """Rotate a batch of bounding boxes or polygons by an angle around the
      image center.
  
      Args:
      ----
          geoms: (N, 4) or (N, 4, 2) array of ABSOLUTE coordinate boxes
          angle: anti-clockwise rotation angle in degrees
          img_shape: the height and width of the image
          expand: whether the image should be padded to avoid information loss
  
      Returns:
      -------
          A batch of rotated polygons (N, 4, 2)
      """
      # Switch to polygons
      polys = (
          np.stack(
              [
                  geoms[:, [0, 1]],
                  geoms[:, [2, 1]],
                  geoms[:, [2, 3]],
                  geoms[:, [0, 3]],
              ],
              axis=1,
          )
          if geoms.ndim == 2
          else geoms
      )
      polys = polys.astype(np.float32)
  
      # Switch to image center as referential
      polys[..., 0] -= img_shape[1] / 2
      polys[..., 1] = img_shape[0] / 2 - polys[..., 1]
  
      # Rotated them around image center
      rotated_polys = rotate_abs_points(
          polys.reshape(-1, 2), angle
      ).reshape(-1, 4, 2)
      # Switch back to top-left corner as referential
      target_shape = (
          compute_expanded_shape(img_shape, angle)
          if expand
          else img_shape
      )
      # Clip coords to fit since there is no expansion
      rotated_polys[..., 0] = (
          rotated_polys[..., 0] + target_shape[1] / 2
      ).clip(0, target_shape[1])
      rotated_polys[..., 1] = (
          target_shape[0] / 2 - rotated_polys[..., 1]
      ).clip(0, target_shape[0])
  
      return rotated_polys
  
file_path: doctr/doctr/utils/geometry.py
imports: from copy import deepcopy
  from math import ceil
  from typing import List, Optional, Tuple, Union
  import cv2
  import numpy
  from .common_types import BoundingBox, Polygon4P
label_desc: Use image node_id 7 for calling a global function with example usage: rotate_abs_geoms(geoms, angle, img_shape, expand) and returns: rotated_polys