code: def load_K_Rt_from_P(filename, P=None):
      if P is None:
          lines = open(filename).read().splitlines()
          if len(lines) == 4:
              lines = lines[1:]
          lines = [
              [x[0], x[1], x[2], x[3]]
              for x in (x.split(" ") for x in lines)
          ]
          P = np.asarray(lines).astype(np.float32).squeeze()
  
      out = cv2.decomposeProjectionMatrix(P)
      K = out[0]
      R = out[1]
      t = out[2]
  
      K = K / K[2, 2]
      intrinsics = np.eye(4)
      intrinsics[:3, :3] = K
  
      pose = np.eye(4, dtype=np.float32)
      to_gl = np.eye(3, dtype=np.float32)
      to_gl[0, 0] = -1.0
      to_gl[1, 1] = -1.0
      pose[:3, :3] = np.dot(R.transpose(), to_gl)
      pose[:3, 3] = (t[:3] / t[3])[:, 0]
  
      return intrinsics, pose
  
file_path: insightface/reconstruction/PBIDR/code/utils/rend_util.py
imports: import numpy
  import imageio
  import skimage
  import cv2
  import torch
  from torch.nn import functional
label_desc: Use image node_id 4 for calling a global function with example usage: load_K_Rt_from_P(filename, P) and returns: intrinsics,  pose