code: def bezier2polygon(
      bezier_points: np.ndarray, num_sample: int = 20
  ) -> List[np.ndarray]:
      # TODO check test later
      """Sample points from the boundary of a polygon enclosed by two Bezier
      curves, which are controlled by ``bezier_points``.
  
      Args:
          bezier_points (ndarray): A :math:`(2, 4, 2)` array of 8 Bezeir points
              or its equalivance. The first 4 points control the curve at one
              side and the last four control the other side.
          num_sample (int): The number of sample points at each Bezeir curve.
              Defaults to 20.
  
      Returns:
          list[ndarray]: A list of 2*num_sample points representing the polygon
          extracted from Bezier curves.
  
      Warning:
          The points are not guaranteed to be ordered. Please use
          :func:`mmocr.utils.sort_points` to sort points if necessary.
      """
      assert num_sample > 0, "The sampling number should greater than 0"
  
      bezier_points = np.asarray(bezier_points)
      assert (
          np.prod(bezier_points.shape) == 16
      ), "Need 8 Bezier control points to continue!"
  
      bezier = (
          bezier_points.reshape(2, 4, 2)
          .transpose(0, 2, 1)
          .reshape(4, 4)
      )
      u = np.linspace(0, 1, num_sample)
  
      points = (
          np.outer((1 - u) ** 3, bezier[:, 0])
          + np.outer(3 * u * ((1 - u) ** 2), bezier[:, 1])
          + np.outer(3 * (u**2) * (1 - u), bezier[:, 2])
          + np.outer(u**3, bezier[:, 3])
      )
  
      # Convert points to polygon
      points = np.concatenate((points[:, :2], points[:, 2:]), axis=0)
      return points.tolist()
  
file_path: mmocr/mmocr/utils/bbox_utils.py
imports: from typing import List, Tuple
  import numpy
  from shapely.geometry import LineString, Point
  from mmocr.utils.check_argument import is_type_list
  from mmocr.utils.point_utils import point_distance, points_center
  from mmocr.utils.typing_utils import ArrayLike
label_desc: Use image node_id 6 for calling a global function with example usage: bezier2polygon(bezier_points, num_sample) and returns: points