code: def get_rotated_box(
      points,
  ) -> typing.Tuple[np.ndarray, float,]:
      """Obtain the parameters of a rotated box.
  
      Returns:
          The vertices of the rotated box in top-left,
          top-right, bottom-right, bottom-left order along
          with the angle of rotation about the bottom left corner.
      """
      try:
          mp = geometry.MultiPoint(points=points)
          pts = np.array(
              list(zip(*mp.minimum_rotated_rectangle.exterior.xy))
          )[
              :-1
          ]  # noqa: E501
      except AttributeError:
          # There weren't enough points for the minimum rotated rectangle function
          pts = points
      # The code below is taken from
      # https://github.com/jrosebr1/imutils/blob/master/imutils/perspective.py
  
      # sort the points based on their x-coordinates
      xSorted = pts[np.argsort(pts[:, 0]), :]
  
      # grab the left-most and right-most points from the sorted
      # x-roodinate points
      leftMost = xSorted[:2, :]
      rightMost = xSorted[2:, :]
  
      # now, sort the left-most coordinates according to their
      # y-coordinates so we can grab the top-left and bottom-left
      # points, respectively
      leftMost = leftMost[np.argsort(leftMost[:, 1]), :]
      (tl, bl) = leftMost
  
      # now that we have the top-left coordinate, use it as an
      # anchor to calculate the Euclidean distance between the
      # top-left and right-most points; by the Pythagorean
      # theorem, the point with the largest distance will be
      # our bottom-right point
      D = spatial.distance.cdist(
          tl[np.newaxis], rightMost, "euclidean"
      )[0]
      (br, tr) = rightMost[np.argsort(D)[::-1], :]
  
      # return the coordinates in top-left, top-right,
      # bottom-right, and bottom-left order
      pts = np.array([tl, tr, br, bl], dtype="float32")
  
      rotation = np.arctan((tl[0] - bl[0]) / (tl[1] - bl[1]))
      return pts, rotation
  
imports: import os
  import io
  import typing
  import hashlib
  import urllib.request
  import urllib.parse
  import cv2
  import imgaug
  import numpy
  import validators
  import typing_extensions
  import matplotlib.pyplot
  from shapely import geometry
  from scipy import spatial
label_desc: Use image node_id 17 for calling a global function with example usage: get_rotated_box(points) and returns: pts,  rotation