code: def pcd_2d_to_pcd_3d(pcd, depth, intrinsic, cam2world=None):
      assert isinstance(
          pcd, np.ndarray
      ), f"cannot process data type: {type(pcd)}"
      assert isinstance(
          intrinsic, np.ndarray
      ), f"cannot process data type: {type(intrinsic)}"
      assert len(pcd.shape) == 2 and pcd.shape[1] >= 2
      assert len(depth.shape) == 2 and depth.shape[1] == 1
      assert intrinsic.shape == (3, 3)
      if cam2world is not None:
          assert isinstance(
              cam2world, np.ndarray
          ), f"cannot process data type: {type(cam2world)}"
          assert cam2world.shape == (4, 4)
  
      x, y, z = pcd[:, 0], pcd[:, 1], depth[:, 0]
      append_ones = np.ones_like(x)
      xyz = np.stack(
          [x, y, append_ones], axis=1
      )  # shape: [num_points, 3]
      inv_intrinsic_mat = np.linalg.inv(intrinsic)
      xyz = np.matmul(inv_intrinsic_mat, xyz.T).T * z[..., None]
      valid_mask_1 = np.where(xyz[:, 2] > 0)
      xyz = xyz[valid_mask_1]
  
      if cam2world is not None:
          append_ones = np.ones_like(xyz[:, 0:1])
          xyzw = np.concatenate([xyz, append_ones], axis=1)
          xyzw = np.matmul(cam2world, xyzw.T).T
          valid_mask_2 = np.where(xyzw[:, 3] != 0)
          xyzw = xyzw[valid_mask_2]
          xyzw /= xyzw[:, 3:4]
          xyz = xyzw[:, 0:3]
  
      if pcd.shape[1] > 2:
          features = pcd[:, 2:]
          try:
              features = features[valid_mask_1][valid_mask_2]
          except UnboundLocalError:
              features = features[valid_mask_1]
          assert xyz.shape[0] == features.shape[0]
          xyz = np.concatenate([xyz, features], axis=1)
      return xyz
  
file_path: ml-neuman/geometry/pcd_projector.py
imports: import numpy
  import torch
label_desc: Use image node_id 2 for calling the PointCloudProjectorNp obj's underlying member method code with example usage: obj.pcd_2d_to_pcd_3d(pcd, depth, intrinsic, cam2world) and returns: xyz