code: def pad(
      img: np.ndarray,
      min_height: int,
      min_width: int,
      border_mode: int = cv2.BORDER_REFLECT_101,
      value: Optional[ImageColorType] = None,
  ) -> np.ndarray:
      height, width = img.shape[:2]
  
      if height < min_height:
          h_pad_top = int((min_height - height) / 2.0)
          h_pad_bottom = min_height - height - h_pad_top
      else:
          h_pad_top = 0
          h_pad_bottom = 0
  
      if width < min_width:
          w_pad_left = int((min_width - width) / 2.0)
          w_pad_right = min_width - width - w_pad_left
      else:
          w_pad_left = 0
          w_pad_right = 0
  
      img = pad_with_params(
          img,
          h_pad_top,
          h_pad_bottom,
          w_pad_left,
          w_pad_right,
          border_mode,
          value,
      )
  
      if img.shape[:2] != (
          max(min_height, height),
          max(min_width, width),
      ):
          raise RuntimeError(
              "Invalid result shape. Got: {}. Expected: {}".format(
                  img.shape[:2],
                  (max(min_height, height), max(min_width, width)),
              )
          )
  
      return img
  
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 47 for calling a global function with example usage: pad(img, min_height, min_width, border_mode, value) and returns: img