code: def main(opt):
      scene = colmap_helper.ColmapAsciiReader.read_scene(
          opt.scene_dir, opt.images_dir, order="video"
      )
      raw_smpl = read_smpl(opt, scene)
  
      assert len(raw_smpl["pose"]) == len(scene.captures)
  
      # estimate the ground
      pcd = o3d.geometry.PointCloud()
      pcd.points = o3d.utility.Vector3dVector(scene.point_cloud[:, :3])
      pcd.colors = o3d.utility.Vector3dVector(
          scene.point_cloud[:, 3:] / 255
      )
  
      plane_model, inliers = pcd.segment_plane(0.02, 3, 1000)
      pcd.points = o3d.utility.Vector3dVector(scene.point_cloud[:, :3])
      pcd.colors = o3d.utility.Vector3dVector(
          scene.point_cloud[:, 3:] / 255
      )
      inliers = (
          np.abs(
              np.sum(
                  np.multiply(
                      scene.point_cloud[:, :3], plane_model[:3]
                  ),
                  axis=1,
              )
              + plane_model[3]
          )
          < 0.02
      )
      inliers = list(np.where(inliers)[0])
      inlier_cloud = pcd.select_by_index(inliers)
      inlier_cloud.paint_uniform_color([1.0, 0, 0])
  
      # solve the alignment
      alignments = {}
      for i, cap in tqdm(
          enumerate(scene.captures), total=len(scene.captures)
      ):
          pts_3d = raw_smpl["joints3d"][i]
          pts_2d = raw_smpl["joints2d_img_coord"][i]
          _, R_rod, t, inl = cv2.solvePnPRansac(
              pts_3d,
              pts_2d,
              cap.pinhole_cam.intrinsic_matrix,
              np.zeros(4),
              flags=cv2.SOLVEPNP_EPNP,
          )
          t = t.astype(np.float32)[:, 0]
          R, _ = cv2.Rodrigues(R_rod)
          quat = transformations.quaternion_from_matrix(R).astype(
              np.float32
          )
  
          smpl_cap = copy.deepcopy(cap)
          smpl_cam_pose = camera_pose.CameraPose(
              Translation(t), Rotation(quat)
          )
          smpl_cap.cam_pose = smpl_cam_pose
  
          # refine the translation and solve the scale
          transf, _ = solve_transformation(
              raw_smpl["verts"][i],
              raw_smpl["joints3d"][i],
              raw_smpl["joints2d_img_coord"][i],
              plane_model,
              cap,
              smpl_cap,
          )
          alignments[os.path.basename(cap.image_path)] = transf
      save_path = os.path.abspath(
          os.path.join(opt.scene_dir, "../alignments.npy")
      )
      np.save(save_path, alignments)
      print(f"alignment matrix saved at: {save_path}")
  
imports: import sys
  import argparse
  import os
  import copy
  import torch
  import joblib
  import numpy
  import open3d
  import cv2
  from tqdm import tqdm
  from data_io import colmap_helper
  from utils import debug_utils, ray_utils
  from cameras import camera_pose
  from geometry.basics import Translation, Rotation
  from geometry import transformations
label_desc: Use image node_id 7 for calling a global function with example usage: main(opt) without return types