code: def _get_translate_matrix(offset, direction="horizontal"):
      """Generate the translate matrix.
  
      Args:
          offset (int | float): The offset used for translate.
          direction (str): The translate direction, either
              "horizontal" or "vertical".
  
      Returns:
          ndarray: The translate matrix with dtype float32.
      """
      if direction == "horizontal":
          translate_matrix = np.float32([[1, 0, offset], [0, 1, 0]])
      elif direction == "vertical":
          translate_matrix = np.float32([[1, 0, 0], [0, 1, offset]])
      return translate_matrix
  
imports: import numbers
  import cv2
  import numpy
  from ..utils import to_2tuple
  from .io import imread_backend
label_desc: Use image node_id 18 for calling a global function with example usage: _get_translate_matrix(offset, direction) and returns: translate_matrix