class_docstr: MMOCR Text Detection Local Visualizer.
  
  Args:
      name (str): Name of the instance. Defaults to 'visualizer'.
      image (np.ndarray, optional): The origin image to draw. The format
          should be RGB. Defaults to None.
      vis_backends (list, optional): Visual backend config list.
          Defaults to None.
      save_dir (str, optional): Save file dir for all storage backends.
          If it is None, the backend storage will not save any data.
      gt_color (str or tuple[int, int, int]): Colors of GT text. The tuple of
          color should be in RGB order. Or using an abbreviation of color,
          such as `'g'` for `'green'`. Defaults to 'g'.
      pred_color (str or tuple[int, int, int]): Colors of Predicted text.
          The tuple of color should be in RGB order. Or using an abbreviation
          of color, such as `'r'` for `'red'`. Defaults to 'r'.
docstr: Draw text on image.
  
  Args:
      image (np.ndarray): The image to draw.
      text (str): The text to draw.
  
  Returns:
      np.ndarray: The image with text drawn.
code: def _draw_instances(self, image: np.ndarray, text: str) -> np.ndarray:
      """Draw text on image.
  
      Args:
          image (np.ndarray): The image to draw.
          text (str): The text to draw.
  
      Returns:
          np.ndarray: The image with text drawn.
      """
      height, width = image.shape[:2]
      empty_img = np.full_like(image, 255)
      self.set_image(empty_img)
      font_size = min(0.5 * width / (len(text) + 1), 0.5 * height)
      self.draw_texts(
          text,
          np.array([width / 2, height / 2]),
          colors=self.gt_color,
          font_sizes=font_size,
          vertical_alignments="center",
          horizontal_alignments="center",
          font_families=self.font_families,
          font_properties=self.font_properties,
      )
      text_image = self.get_image()
      return text_image
  
file_path: mmocr/mmocr/visualization/textrecog_visualizer.py
imports: from typing import Dict, Optional, Tuple, Union
  import cv2
  import mmcv
  import numpy
  from mmocr.registry import VISUALIZERS
  from mmocr.structures import TextRecogDataSample
  from .base_visualizer import BaseLocalVisualizer
label_desc: Use image node_id 2 for calling the TextRecogLocalVisualizer obj's underlying member method code with example usage: obj._draw_instances(image, text) and returns: text_image