code: def skeletonize(image, size, structuring=cv2.MORPH_RECT):
      # determine the area (i.e. total number of pixels in the image),
      # initialize the output skeletonized image, and construct the
      # morphological structuring element
      area = image.shape[0] * image.shape[1]
      skeleton = np.zeros(image.shape, dtype="uint8")
      elem = cv2.getStructuringElement(structuring, size)
  
      # keep looping until the erosions remove all pixels from the
      # image
      while True:
          # erode and dilate the image using the structuring element
          eroded = cv2.erode(image, elem)
          temp = cv2.dilate(eroded, elem)
  
          # subtract the temporary image from the original, eroded
          # image, then take the bitwise 'or' between the skeleton
          # and the temporary image
          temp = cv2.subtract(image, temp)
          skeleton = cv2.bitwise_or(skeleton, temp)
          image = eroded.copy()
  
          # if there are no more 'white' pixels in the image, then
          # break from the loop
          if area == area - cv2.countNonZero(image):
              break
  
      # return the skeletonized image
      return skeleton
  
file_path: imutils/imutils/convenience.py
imports: import numpy
  import cv2
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: skeletonize(image, size, structuring) and returns: skeleton