code: def process_img(
      args, dst_image_root, ignore_image_root, preserve_vertical, split
  ):
      # Dirty hack for multi-processing
      img_idx, img_info, anns = args
      src_img = mmcv.imread(img_info["file_name"])
      img_info = []
      for ann_idx, ann in enumerate(anns):
          segmentation = []
          for x, y in ann["points"]:
              segmentation.append(max(0, x))
              segmentation.append(max(0, y))
          xs, ys = segmentation[::2], segmentation[1::2]
          x, y = min(xs), min(ys)
          w, h = max(xs) - x, max(ys) - y
          text_label = ann["transcription"]
  
          dst_img = src_img[y : y + h, x : x + w]
          dst_img_name = f"img_{img_idx}_{ann_idx}.jpg"
  
          if not preserve_vertical and h / w > 2 and split == "train":
              dst_img_path = osp.join(ignore_image_root, dst_img_name)
              mmcv.imwrite(dst_img, dst_img_path)
              continue
  
          dst_img_path = osp.join(dst_image_root, dst_img_name)
          mmcv.imwrite(dst_img, dst_img_path)
  
          img_info.append(
              {
                  "file_name": dst_img_name,
                  "anno_info": [{"text": text_label}],
              }
          )
  
      return img_info
  
file_path: mmocr/tools/dataset_converters/textrecog/lsvt_converter.py
imports: import argparse
  import math
  import os.path
  from functools import partial
  import mmcv
  import mmengine
  from mmocr.utils import dump_ocr_data
label_desc: Use image node_id 2 for calling a global function with example usage: process_img(args, dst_image_root, ignore_image_root, preserve_vertical, split) and returns: img_info