code: def cv_rotate(img, rot, resW, resH):
      cv2 = try_import_cv2()
      center = np.array((resW - 1, resH - 1)) / 2
      rot_rad = np.pi * rot / 180
  
      src_dir = get_dir([0, (resH - 1) * -0.5], rot_rad)
      dst_dir = np.array([0, (resH - 1) * -0.5], np.float32)
  
      src = np.zeros((3, 2), dtype=np.float32)
      dst = np.zeros((3, 2), dtype=np.float32)
  
      src[0, :] = center
      src[1, :] = center + src_dir
      dst[0, :] = [(resW - 1) * 0.5, (resH - 1) * 0.5]
      dst[1, :] = (
          np.array([(resW - 1) * 0.5, (resH - 1) * 0.5]) + dst_dir
      )
  
      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 21 for calling a global function with example usage: cv_rotate(img, rot, resW, resH) and returns: dst_img