code: def get_bbox(height, width, points):
      polygons = points
      mask = np.zeros([height, width], dtype=np.uint8)
      mask = PIL.Image.fromarray(mask)
      xy = list(map(tuple, polygons))
      PIL.ImageDraw.Draw(mask).polygon(xy=xy, outline=1, fill=1)
      mask = np.array(mask, dtype=bool)
      index = np.argwhere(mask == 1)
      rows = index[:, 0]
      clos = index[:, 1]
      left_top_r = np.min(rows)
      left_top_c = np.min(clos)
      right_bottom_r = np.max(rows)
      right_bottom_c = np.max(clos)
      return [
          left_top_c,
          left_top_r,
          right_bottom_c - left_top_c,
          right_bottom_r - left_top_r,
      ]
  
imports: import argparse
  import glob
  import json
  import os
  import os.path
  import shutil
  import xml.etree.ElementTree
  import numpy
  import PIL.ImageDraw
  from tqdm import tqdm
  import cv2
label_desc: Use image node_id 6 for calling a global function with example usage: get_bbox(height, width, points) and returns: list