code: def matrix2angle(R):
      """compute three Euler angles from a Rotation Matrix. Ref: http://www.gregslabaugh.net/publications/euler.pdf
      Args:
          R: (3,3). rotation matrix
      Returns:
          x: yaw
          y: pitch
          z: roll
      """
      # assert(isRotationMatrix(R))
  
      if R[2, 0] != 1 or R[2, 0] != -1:
          x = asin(R[2, 0])
          y = atan2(R[2, 1] / cos(x), R[2, 2] / cos(x))
          z = atan2(R[1, 0] / cos(x), R[0, 0] / cos(x))
  
      else:  # Gimbal lock
          z = 0  # can be anything
          if R[2, 0] == -1:
              x = np.pi / 2
              y = z + atan2(R[0, 1], R[0, 2])
          else:
              x = -np.pi / 2
              y = -z + atan2(-R[0, 1], -R[0, 2])
  
      return x, y, z
  
file_path: PaddleHub/modules/image/image_processing/prnet/utils/estimate_pose.py
imports: from math import asin
  from math import atan2
  from math import cos
  from math import sin
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: matrix2angle(R) and returns: x,  y,  z