code: def get_normalization(source_dir):
      print("Preprocessing", source_dir)
  
      masks_dir = "{0}/mask".format(source_dir)
      mask_points_all, masks_all = get_all_mask_points_white_bg(
          masks_dir
      )
      number_of_cameras = len(masks_all)
      R = np.load("{0}/R.npy".format(source_dir))
      T = np.load("{0}/T.npy".format(source_dir))
      Ps = get_Ps_from_Faces(R, T)
      normalization = np.eye(4).astype(np.float32)
  
      cameras_new = {}
      for i in range(number_of_cameras):
          cameras_new["scale_mat_%d" % i] = normalization
          cameras_new["world_mat_%d" % i] = np.concatenate(
              (Ps[i], np.array([[0, 0, 0, 1.0]])), axis=0
          ).astype(np.float32)
  
      np.savez(
          "{0}/{1}.npz".format(source_dir, "cameras"), **cameras_new
      )
      print(normalization)
      print("--------------------------------------------------------")
  
      if False:  # for debugging
          for i in range(number_of_cameras):
              plt.figure()
  
              plt.imshow(
                  mpimg.imread(
                      "%s/%03d.png"
                      % ("{0}/mask".format(source_dir), i + 1)
                  )
              )
              xy = (
                  Ps[i, :2, :]
                  @ (
                      np.concatenate(
                          (np.array(all_Xs), np.ones((len(all_Xs), 1))),
                          axis=1,
                      ).T
                  )
              ) / (
                  Ps[i, 2, :]
                  @ (
                      np.concatenate(
                          (np.array(all_Xs), np.ones((len(all_Xs), 1))),
                          axis=1,
                      ).T
                  )
              )
  
              plt.plot(xy[0, :], xy[1, :], "*")
              plt.show()
  
file_path: insightface/reconstruction/PBIDR/code/preprocess/preprocess_cameras.py
imports: import numpy
  import matplotlib.image
  import matplotlib.pyplot
  import cv2
  import argparse
  from glob import glob
  import os
  import sys
  import pickle
  from scipy.spatial.transform import Rotation
  import utils.general
label_desc: Use image node_id 3 for calling a global function with example usage: get_normalization(source_dir) without return types