code: def get_screen_points(camera, K, image_w, image_h, points3d):
      # get 4x4 matrix to transform points from world to camera coordinates
      world_2_camera = np.array(
          camera.get_transform().get_inverse_matrix()
      )
  
      # build the points array in numpy format as (x, y, z, 1) to be operable with a 4x4 matrix
      points_temp = []
      for p in points3d:
          points_temp += [p.x, p.y, p.z, 1]
      points = np.array(points_temp).reshape(-1, 4).T
  
      # convert world points to camera space
      points_camera = np.dot(world_2_camera, points)
  
      # New we must change from UE4's coordinate system to an "standard"
      # (x, y ,z) -> (y, -z, x)
      # and we remove the fourth component also
      points = np.array(
          [points_camera[1], points_camera[2] * -1, points_camera[0]]
      )
  
      # Finally we can use our K matrix to do the actual 3D -> 2D.
      points_2d = np.dot(K, points)
  
      # normalize the values and transpose
      points_2d = np.array(
          [
              points_2d[0, :] / points_2d[2, :],
              points_2d[1, :] / points_2d[2, :],
              points_2d[2, :],
          ]
      ).T
  
      return points_2d
  
imports: import glob
  import os
  import sys
  import math
  import argparse
  import copy
  import time
  from multiprocessing import Pool
  from PIL import Image
  import carla
  import random
label_desc: Use image node_id 5 for calling a global function with example usage: get_screen_points(camera, K, image_w, image_h, points3d) and returns: points_2d