code: def texturesuv_image_PIL(
      texture: TexturesUV,
      *,
      texture_index: int = 0,
      radius: float = 1,
      color: Any = "red",
      subsample: Optional[int] = 10000,
  ):  # pragma: no cover
      """
      Return a PIL image of the texture image of one element of the batch
      from a TexturesUV, together with the verts_uvs positions circled.
      In particular a value in verts_uvs which is never referenced
      in faces_uvs will still be plotted.
      This is for debugging purposes, e.g. to align the map with
      the uv coordinates. In particular, matplotlib
      is used which is not an official dependency of PyTorch3D.
  
      Args:
          texture: a TexturesUV object with one mesh
          texture_index: index in the batch to plot
          radius: plotted circle radius in pixels
          color: any PIL-understood color for the circles.
          subsample: if not None, number of points to plot.
                  Otherwise all points are plotted.
  
      Returns:
          PIL Image object.
      """
  
      centers = texture.centers_for_image(index=texture_index).numpy()
      texture_image = texture.maps_padded()
      texture_array = (
          (texture_image[texture_index] * 255)
          .cpu()
          .numpy()
          .astype(np.uint8)
      )
  
      image = Image.fromarray(texture_array)
      draw = ImageDraw.Draw(image)
  
      n_points = centers.shape[0]
      if subsample is None or n_points <= subsample:
          indices = range(n_points)
      else:
          indices = np.random.choice(n_points, subsample, replace=False)
  
      for i in indices:
          x = centers[i][0]
          y = centers[i][1]
          draw.ellipse(
              [(x - radius, y - radius), (x + radius, y + radius)],
              fill=color,
          )
  
      return image
  
imports: from typing import Any, Optional
  import numpy
  from PIL import Image, ImageDraw
  from pytorch3d.renderer.mesh import TexturesUV
label_desc: Use image node_id 2 for calling a global function with example usage: texturesuv_image_PIL(texture) and returns: image