code: def curve2bezier(curve: ArrayLike):
      curve = np.array(curve).reshape(-1, 2)
      if len(curve) == 2:
          return linear_interpolation(curve[0], curve[1])
      diff = curve[1:] - curve[:-1]
      distance = np.linalg.norm(diff, axis=-1)
      norm_distance = distance / distance.sum()
      norm_distance = np.hstack(([0], norm_distance))
      cum_norm_dis = norm_distance.cumsum()
      pseudo_inv = np.linalg.pinv(
          bezier_coefficients(3, 4, cum_norm_dis)
      )
      control_points = pseudo_inv.dot(curve)
      return control_points
  
file_path: mmocr/mmocr/utils/bezier_utils.py
imports: import numpy
  from scipy.special import comb
  from mmocr.utils.typing_utils import ArrayLike
label_desc: Use image node_id 4 for calling a global function with example usage: curve2bezier(curve) and returns: control_points, linear_interpolation