code: def pcd_2d_to_img(pcd, size, has_z=False, keep_z=False):
      assert (
          len(pcd.shape) == 2 and pcd.shape[-1] >= 2
      ), f"seems the input pcd is not a valid point cloud: {pcd.shape}"
      if has_z:
          pcd = pcd[pcd[:, 2].argsort()[::-1]]
          if not keep_z:
              pcd = np.delete(pcd, [2], axis=1)
      index_list = np.round(pcd[:, 0:2]).astype(np.int32)
      index_list[:, 0] = np.clip(index_list[:, 0], 0, size[1] - 1)
      index_list[:, 1] = np.clip(index_list[:, 1], 0, size[0] - 1)
      _h, _w, _c = *size, pcd.shape[-1] - 2
      if _c == 0:
          canvas = np.zeros((_h, _w, 1))
          canvas[index_list[:, 1], index_list[:, 0]] = 1.0
      else:
          canvas = np.zeros((_h, _w, _c))
          canvas[index_list[:, 1], index_list[:, 0]] = pcd[:, 2:]
  
      return canvas
  
file_path: ml-neuman/geometry/pcd_projector.py
imports: import numpy
  import torch
label_desc: Use image node_id 5 for calling the PointCloudProjectorNp obj's underlying member method code with example usage: obj.pcd_2d_to_img(pcd, size, has_z, keep_z) and returns: canvas