code: def apply_transform(matrix, image, params):
      """
      Apply a transformation to an image.
  
      The origin of transformation is at the top left corner of the image.
  
      The matrix is interpreted such that a point (x, y) on the original image is moved to transform * (x, y) in the generated image.
      Mathematically speaking, that means that the matrix is a transformation from the transformed image space to the original image space.
  
      Args
        matrix: A homogeneous 3 by 3 matrix holding representing the transformation to apply.
        image:  The image to transform.
        params: The transform parameters (see TransformParameters)
      """
      output = cv2.warpAffine(
          image,
          matrix[:2, :],
          dsize=(image.shape[1], image.shape[0]),
          flags=params.cvInterpolation(),
          borderMode=params.cvBorderMode(),
          borderValue=params.cval,
      )
      return output
  
imports: from __future__ import division
  import numpy
  import cv2
  from PIL import Image
  from .transform import change_transform_origin
label_desc: Use image node_id 4 for calling a global function with example usage: apply_transform(matrix, image, params) and returns: output