code: def add_label(
      image: np.ndarray,
      label_name: str,
      color: tuple[int, int, int],
      confidence: float | None = None,
      font_scale: float = 5e-3,
      thickness_scale=1e-3,
  ) -> np.ndarray:
      """Adds a label to an image.
  
      Args:
          image (np.ndarray): Input image.
          label_name (str): Name of the label that will be displayed on the image.
          color (tuple[int, int, int]): RGB values for background color of label.
          confidence (float | None): confidence score of the label.
          font_scale (float): scale of the font size relative to image size. Increase for bigger font.
          thickness_scale (float): scale of the font thickness. Increase for thicker font.
  
      Returns:
          np.ndarray: Image with label.
      """
      image = image.copy()
      img_height, img_width, _ = image.shape
  
      font = cv2.FONT_HERSHEY_PLAIN
      text = (
          label_name
          if confidence is None
          else f"{label_name} ({confidence*100:.0f}%)"
      )
  
      # get font sizing
      font_scale = min(img_width, img_height) * font_scale
      thickness = math.ceil(
          min(img_width, img_height) * thickness_scale
      )
      (width, height), baseline = cv2.getTextSize(
          text, font, fontScale=font_scale, thickness=thickness
      )
  
      # create label
      label_patch = np.zeros(
          (height + baseline, width + baseline, 3), dtype=np.uint8
      )
      label_patch[:, :] = color
      cv2.putText(
          label_patch,
          text,
          (0, baseline // 2 + height),
          font,
          fontScale=font_scale,
          thickness=thickness,
          color=0,
          lineType=cv2.LINE_AA,
      )
  
      # add label to image
      image[: baseline + height, : baseline + width] = label_patch
      return image
  
file_path: anomalib/src/anomalib/post_processing/post_process.py
imports: from __future__ import annotations
  import math
  from enum import Enum
  import cv2
  import numpy
  from skimage import morphology
label_desc: Use image node_id 1 for calling a global function with example usage: add_label(image, label_name, color, confidence, font_scale, thickness_scale) and returns: image