code: def slide_crop_image(
      src_path, out_dir, mode, patch_H, patch_W, overlap
  ):
      img = np.asarray(Image.open(src_path).convert("RGB"))
  
      img_H, img_W, _ = img.shape
  
      if img_H < patch_H and img_W > patch_W:
          img = pad(img, shape=(patch_H, img_W), pad_val=0)
  
          img_H, img_W, _ = img.shape
  
      elif img_H > patch_H and img_W < patch_W:
          img = pad(img, shape=(img_H, patch_W), pad_val=0)
  
          img_H, img_W, _ = img.shape
  
      elif img_H < patch_H and img_W < patch_W:
          img = pad(img, shape=(patch_H, patch_W), pad_val=0)
  
          img_H, img_W, _ = img.shape
  
      for x in range(0, img_W, patch_W - overlap):
          for y in range(0, img_H, patch_H - overlap):
              x_str = x
              x_end = x + patch_W
              if x_end > img_W:
                  diff_x = x_end - img_W
                  x_str -= diff_x
                  x_end = img_W
              y_str = y
              y_end = y + patch_H
              if y_end > img_H:
                  diff_y = y_end - img_H
                  y_str -= diff_y
                  y_end = img_H
  
              img_patch = img[y_str:y_end, x_str:x_end, :]
              img_patch = Image.fromarray(img_patch.astype(np.uint8))
              image = (
                  osp.basename(src_path).split(".")[0]
                  + "_"
                  + str(y_str)
                  + "_"
                  + str(y_end)
                  + "_"
                  + str(x_str)
                  + "_"
                  + str(x_end)
                  + ".png"
              )
              # print(image)
              save_path_image = osp.join(
                  out_dir, "img_dir", mode, str(image)
              )
              img_patch.save(save_path_image)
  
file_path: PaddleSeg/contrib/RSSegBenchmark/data/prepare_isaid.py
imports: import argparse
  import glob
  import os
  import os.path
  import shutil
  import tempfile
  import zipfile
  import cv2
  import numpy
  from tqdm import tqdm
  from PIL import Image
label_desc: Use image node_id 4 for calling a global function with example usage: slide_crop_image(src_path, out_dir, mode, patch_H, patch_W, overlap) without return types