code: def perform_ocr(
      image,
      scale=10,
      order=5,
      horizontal_closing=10,
      vertical_closing=5,
  ):
      image = skimage.transform.resize(
          image,
          (image.shape[0] * scale, image.shape[1] * scale),
          mode="edge",
          order=order,
      )
  
      image = image > skimage.filters.threshold_otsu(image)
  
      black_pixel_count = image[image == 0].size
      white_pixel_count = image[image == 1].size
  
      if black_pixel_count > white_pixel_count:
          image = skimage.util.invert(image)
  
      image = skimage.morphology.closing(
          image, skimage.morphology.rectangle(1, horizontal_closing)
      )
      image = skimage.morphology.closing(
          image, skimage.morphology.rectangle(vertical_closing, 1)
      )
  
      image = skimage.util.img_as_ubyte(image)
  
      return pytesseract.image_to_string(Image.fromarray(image))
  
file_path: SerpentAI/serpent/ocr.py
imports: import pathlib
  import shutil
  import skimage.color
  import skimage.segmentation
  import skimage.filters
  import skimage.morphology
  import skimage.util
  import skimage.transform
  import skimage.measure
  import skimage.io
  import pytesseract
  from PIL import Image
  from serpent.utilities import is_windows
label_desc: Use image node_id 5 for calling a global function with example usage: perform_ocr(image, scale, order, horizontal_closing, vertical_closing) and returns: pytesseract