code: def cv2_to_base64(image: np.ndarray):
      data = cv2.imencode(".jpg", image)[1]
      return base64.b64encode(data.tostring()).decode("utf8")
  
imports: import os
  import math
  import base64
  from typing import Callable
  import cv2
  import numpy
  import matplotlib
  from matplotlib import pyplot
  from matplotlib.figure import Figure
  from matplotlib.backends.backend_agg import FigureCanvasAgg
label_desc: Use image node_id 2 for calling a global function with example usage: cv2_to_base64(image) and returns: base64