code: def cv_cropBox(img, ul, br, resH, resW, pad_val=0):
      cv2 = try_import_cv2()
      ul = ul
      br = br - 1
      # br = br.int()
      lenH = max(
          (br[1] - ul[1]).item(), (br[0] - ul[0]).item() * resH / resW
      )
      lenW = lenH * resW / resH
      if img.ndim == 2:
          img = img[:, np.newaxis]
  
      box_shape = [br[1] - ul[1], br[0] - ul[0]]
      pad_size = [
          (lenH - box_shape[0]) // 2,
          (lenW - box_shape[1]) // 2,
      ]
      # Padding Zeros
      img[: ul[1], :, :], img[:, : ul[0], :] = pad_val, pad_val
      img[br[1] + 1 :, :, :], img[:, br[0] + 1 :, :] = pad_val, pad_val
  
      src = np.zeros((3, 2), dtype=np.float32)
      dst = np.zeros((3, 2), dtype=np.float32)
  
      src[0, :] = np.array(
          [ul[0] - pad_size[1], ul[1] - pad_size[0]], np.float32
      )
      src[1, :] = np.array(
          [br[0] + pad_size[1], br[1] + pad_size[0]], np.float32
      )
      dst[0, :] = 0
      dst[1, :] = np.array([resW - 1, resH - 1], np.float32)
  
      src[2:, :] = get_3rd_point(src[0, :], src[1, :])
      dst[2:, :] = get_3rd_point(dst[0, :], dst[1, :])
  
      trans = cv2.getAffineTransform(np.float32(src), np.float32(dst))
  
      dst_img = cv2.warpAffine(
          img, trans, (resW, resH), flags=cv2.INTER_LINEAR
      )
  
      return dst_img
  
imports: from __future__ import absolute_import
  from __future__ import division
  import math
  import random
  import numpy
  import mxnet
  from mxnet import nd, image
  from mxnet.gluon.data.vision import transforms
  from ...utils.filesystem import try_import_cv2
label_desc: Use image node_id 20 for calling a global function with example usage: cv_cropBox(img, ul, br, resH, resW, pad_val) and returns: dst_img