code: def generate_ground_image(
      height,
      width,
      focal,
      principal_point,
      camera_rotation_matrix,
      camera_translation_vector,
      ground_color=(0.43, 0.43, 0.8),
  ):
      """Generate an image depicting only the ground."""
      batch_size = camera_rotation_matrix.shape[0]
      background_image = np.ones(
          (batch_size, height, width, 1, 1), dtype=np.float32
      )
      background_image[
          :, -1, ...
      ] = 0  # Zero the bottom line for proper sampling
  
      # The projection of the ground depends on the top right corner (approximation)
      plane_point_np = np.tile(
          np.array([[3.077984, 2.905388, 0.0]], dtype=np.float32),
          (batch_size, 1),
      )
      plane_point_rotated = rotation_matrix_3d.rotate(
          plane_point_np, camera_rotation_matrix
      )
      plane_point_translated = (
          plane_point_rotated + camera_translation_vector
      )
      plane_point2d = perspective.project(
          plane_point_translated, focal, principal_point
      )
      _, y = tf.split(plane_point2d, [1, 1], axis=-1)
      sfactor = height / y
      helper_matrix1 = np.tile(
          np.array([[[1, 0, 0], [0, 0, 0], [0, 0, 0]]]),
          (batch_size, 1, 1),
      )
      helper_matrix2 = np.tile(
          np.array([[[0, 0, 0], [0, 1, 0], [0, 0, 1]]]),
          (batch_size, 1, 1),
      )
      transformation_matrix = (
          tf.multiply(tf.expand_dims(sfactor, -1), helper_matrix1)
          + helper_matrix2
      )
      plane_points = grid.generate(
          (0.0, 0.0, 0.0),
          (float(height), float(width), 0.0),
          (height, width, 1),
      )
      plane_points = tf.reshape(plane_points, [-1, 3])
      transf_plane_points = tf.matmul(
          transformation_matrix, plane_points, transpose_b=True
      )
      interpolated_points = trilinear.interpolate(
          background_image,
          tf.linalg.matrix_transpose(transf_plane_points),
      )
      ground_alpha = 1 - tf.reshape(
          interpolated_points, [batch_size, height, width, 1]
      )
      ground_image = (
          tf.ones((batch_size, height, width, 3)) * ground_color
      )
      return ground_image, ground_alpha
  
file_path: graphics/tensorflow_graphics/projects/neural_voxel_renderer/helpers.py
imports: import numpy
  import tensorflow
  from tensorflow_graphics.geometry.representation import grid
  from tensorflow_graphics.geometry.transformation import rotation_matrix_3d
  from tensorflow_graphics.math.interpolation import trilinear
  from tensorflow_graphics.rendering.camera import perspective
  from tensorflow_graphics.rendering.volumetric import emission_absorption
label_desc: Use image node_id 1 for calling a global function with example usage: generate_ground_image(height, width, focal, principal_point, camera_rotation_matrix, camera_translation_vector, ground_color) and returns: ground_image,  ground_alpha