code: def solver_rigid(pts_3d, pts_2d, camera_matrix):
      # pts_3d  Nx3
      # pts_2d  Nx2
      # camera_matrix 4x4
      dist_coeffs = np.zeros((4, 1))
      pts_3d = pts_3d.copy()
      pts_2d = pts_2d.copy()
      # print(pts_3d.shape, pts_3d.dtype, pts_2d.shape, pts_2d.dtype)
      success, rotation_vector, translation_vector = cv2.solvePnP(
          pts_3d, pts_2d, camera_matrix, dist_coeffs, flags=0
      )
      assert success
      R, _ = cv2.Rodrigues(rotation_vector)
      R = R.T
      R[:, 1:3] *= -1
      T = translation_vector.flatten()
      T[1:] *= -1
  
      return R, T
  
imports: import os
  import time
  import timm
  import glob
  import numpy
  import os.path
  import cv2
  import torch
  import torch.distributed
  from torch import nn
  from pathlib import Path
  from backbones import get_network
  from skimage import transform
  from scipy.spatial.transform import Rotation
label_desc: Use image node_id 4 for calling a global function with example usage: solver_rigid(pts_3d, pts_2d, camera_matrix) and returns: R,  T