code: def crop_hwc(image, bbox, out_sz, padding=(0, 0, 0)):
      """
      crop image
  
      Parameters
      ----------
      image: np.array, image
      bbox: np or list, bbox coordinate [xmin,ymin,xmax,ymax]
      out_sz: int , crop image size
  
      Return:
          crop result
      """
      a = (out_sz - 1) / (bbox[2] - bbox[0])
      b = (out_sz - 1) / (bbox[3] - bbox[1])
      c = -a * bbox[0]
      d = -b * bbox[1]
      mapping = np.array([[a, 0, c], [0, b, d]]).astype(np.float)
      cv2 = try_import_cv2()
      crop = cv2.warpAffine(
          image,
          mapping,
          (out_sz, out_sz),
          borderMode=cv2.BORDER_CONSTANT,
          borderValue=padding,
      )
      return crop
  
imports: import numpy
  import sys
  from ..filesystem import try_import_cv2
label_desc: Use image node_id 1 for calling a global function with example usage: crop_hwc(image, bbox, out_sz, padding) and returns: crop