code: def upright_camera_relative_transform(pose):
      """Generate pose matrix with z-dim as height
  
      Args:
          pose: np.array (4, 4)
      Returns:
          urc: (4, 4)
          urc_inv: (4, 4)
      """
  
      # take viewing direction in camera local coordiantes (which is simply unit vector along +z)
      view_dir_camera = np.asarray([0, 0, 1])
      R = pose[0:3, 0:3]
      t = pose[0:3, 3]
  
      # convert to world coordinates
      view_dir_world = np.dot(R, view_dir_camera)
  
      # compute heading
      view_dir_xy = view_dir_world[0:2]
      heading = math.atan2(view_dir_xy[1], view_dir_xy[0])
  
      # compute rotation around Z to align heading with +Y
      zRot = -heading + math.pi / 2
  
      # translation first, back to camera point
      urc_t = np.identity(4)
      urc_t[0:2, 3] = -1 * t[0:2]
  
      # compute rotation matrix
      urc_r = np.identity(4)
      urc_r[0:3, 0:3] = eulerAnglesToRotationMatrix([0, 0, zRot])
  
      urc = np.dot(urc_r, urc_t)
      urc_inv = np.linalg.inv(urc)
  
      return urc, urc_inv
  
file_path: ARKitScenes/threedod/benchmark_scripts/utils/rotation.py
imports: import cv2
  import math
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: upright_camera_relative_transform(pose) and returns: urc,  urc_inv