docs: def _colorize(self, depth_im, color_im):
          """Colorize a depth image from the PhoXi using a color image from the webcam.
  
          Parameters
          ----------
          depth_im : DepthImage
              The PhoXi depth image.
          color_im : ColorImage
              Corresponding color image.
  
          Returns
          -------
          ColorImage
              A colorized image corresponding to the PhoXi depth image.
          """
          # Project the point cloud into the webcam's frame
          target_shape = (depth_im.data.shape[0], depth_im.data.shape[1], 3)
          pc_depth = self._phoxi.ir_intrinsics.deproject(depth_im)
          pc_color = self._T_webcam_world.inverse().dot(self._T_phoxi_world).apply(pc_depth)
  
          # Sort the points by their distance from the webcam's apeture
          pc_data = pc_color.data.T
          dists = np.linalg.norm(pc_data, axis=1)
          order = np.argsort(dists)
          pc_data = pc_data[order]
          pc_color = PointCloud(pc_data.T, frame=self._webcam.color_intrinsics.frame)
          sorted_dists = dists[order]
          sorted_depths = depth_im.data.flatten()[order]
  
          # Generate image coordinates for each sorted point
          icds = self._webcam.color_intrinsics.project(pc_color).data.T
  
          # Create mask for points that are masked by others
          rounded_icds = np.array(icds / 3.0, dtype=np.uint32)
          unique_icds, unique_inds, unique_inv = np.unique(rounded_icds, axis=0, return_index=True, return_inverse=True)
          icd_depths = sorted_dists[unique_inds]
          min_depths_pp = icd_depths[unique_inv]
          depth_delta_mask = np.abs(min_depths_pp - sorted_dists) < 5e-3
  
          # Create mask for points with missing depth or that lie outside the image
          valid_mask = np.logical_and(np.logical_and(icds[:,0] >= 0, icds[:,0] < self._webcam.color_intrinsics.width),
                                      np.logical_and(icds[:,1] >= 0, icds[:,1] < self._webcam.color_intrinsics.height))
          valid_mask = np.logical_and(valid_mask, sorted_depths != 0.0)
          valid_mask = np.logical_and(valid_mask, depth_delta_mask)
          valid_icds = icds[valid_mask]
  
          colors = color_im.data[valid_icds[:,1],valid_icds[:,0],:]
          color_im_data = np.zeros((target_shape[0] * target_shape[1], target_shape[2]), dtype=np.uint8)
          color_im_data[valid_mask] = colors
          color_im_data[order] = color_im_data.copy()
          color_im_data = color_im_data.reshape(target_shape)
          return ColorImage(color_im_data, frame=self._frame)