code: def transform(data, center, output_size, scale, rotation):
      scale_ratio = float(output_size) / scale
      rot = float(rotation) * np.pi / 180.0
      # translation = (output_size/2-center[0]*scale_ratio, output_size/2-center[1]*scale_ratio)
      t1 = stf.SimilarityTransform(scale=scale_ratio)
      cx = center[0] * scale_ratio
      cy = center[1] * scale_ratio
      t2 = stf.SimilarityTransform(translation=(-1 * cx, -1 * cy))
      t3 = stf.SimilarityTransform(rotation=rot)
      t4 = stf.SimilarityTransform(
          translation=(output_size / 2, output_size / 2)
      )
      t = t1 + t2 + t3 + t4
      trans = t.params[0:2]
      # print('M', scale, rotation, trans)
      cropped = cv2.warpAffine(
          data, trans, (output_size, output_size), borderValue=0.0
      )
      return cropped, trans
  
file_path: insightface/alignment/heatmap/img_helper.py
imports: import numpy
  import math
  import cv2
  from skimage import transform
label_desc: Use image node_id 1 for calling a global function with example usage: transform(data, center, output_size, scale, rotation) and returns: cropped,  trans