code: def perspective_bbox(
      bbox: BoxInternalType,
      height: int,
      width: int,
      matrix: np.ndarray,
      max_width: int,
      max_height: int,
      keep_size: bool,
  ) -> BoxInternalType:
      x1, y1, x2, y2 = denormalize_bbox(bbox, height, width)[:4]
  
      points = np.array(
          [[x1, y1], [x2, y1], [x2, y2], [x1, y2]], dtype=np.float32
      )
  
      x1, y1, x2, y2 = float("inf"), float("inf"), 0, 0
      for pt in points:
          pt = perspective_keypoint(
              pt.tolist() + [0, 0],
              height,
              width,
              matrix,
              max_width,
              max_height,
              keep_size,
          )
          x, y = pt[:2]
          x1 = min(x1, x)
          x2 = max(x2, x)
          y1 = min(y1, y)
          y2 = max(y2, y)
  
      return normalize_bbox(
          (x1, y1, x2, y2),
          height if keep_size else max_height,
          width if keep_size else max_width,
      )
  
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import cv2
  import numpy
  import skimage.transform
  from scipy.ndimage import gaussian_filter
  from albumentations.augmentations.utils import _maybe_process_in_chunks, angle_2pi_range, clipped, preserve_channel_dim, preserve_shape
  from ...None import random_utils
  from ...core.bbox_utils import denormalize_bbox, normalize_bbox
  from ...core.transforms_interface import BoxInternalType, FillValueType, ImageColorType, KeypointInternalType
label_desc: Use image node_id 18 for calling a global function with example usage: perspective_bbox(bbox, height, width, matrix, max_width, max_height, keep_size) and returns: normalize_bbox