code: def point_pair2poly(point_pair_list):
      """
      Transfer vertical point_pairs into poly point in clockwise.
      """
      pair_length_list = []
      for point_pair in point_pair_list:
          pair_length = np.linalg.norm(point_pair[0] - point_pair[1])
          pair_length_list.append(pair_length)
      pair_length_list = np.array(pair_length_list)
      pair_info = (
          pair_length_list.max(),
          pair_length_list.min(),
          pair_length_list.mean(),
      )
  
      point_num = len(point_pair_list) * 2
      point_list = [0] * point_num
      for idx, point_pair in enumerate(point_pair_list):
          point_list[idx] = point_pair[0]
          point_list[point_num - 1 - idx] = point_pair[1]
      return np.array(point_list).reshape(-1, 2), pair_info
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import cv2
  import math
  import numpy
  from itertools import groupby
  from skimage.morphology._skeletonize import thin
label_desc: Use image node_id 2 for calling a global function with example usage: point_pair2poly(point_pair_list) and returns: np,  pair_info