code: def poly2rbox_np(polys, rbox_type="oc"):
      """
      polys: [x0,y0,x1,y1,x2,y2,x3,y3]
      to
      rboxes: [x_ctr,y_ctr,w,h,angle]
      """
      assert rbox_type in [
          "oc",
          "le135",
      ], "only oc or le135 is supported now"
      poly2rbox_fn = (
          poly2rbox_oc_np if rbox_type == "oc" else poly2rbox_le135_np
      )
      rboxes = []
      for poly in polys:
          x, y, w, h, angle = poly2rbox_fn(poly)
          rbox = np.array([x, y, w, h, angle], dtype=np.float32)
          rboxes.append(rbox)
  
      return np.array(rboxes)
  
file_path: PaddleDetection/ppdet/modeling/rbox_utils.py
imports: import math
  import paddle
  import numpy
  import cv2
label_desc: Use image node_id 4 for calling a global function with example usage: poly2rbox_np(polys, rbox_type) and returns: np