def skeletonize(image):
 image = image.astype(np.uint8)
 if (image.ndim != 2):
  raise ValueError('Skeletonize requires a 2D array')
 if (not np.all(np.in1d(image.flat, (0, 1)))):
  raise ValueError('Image contains values other than 0 and 1')
 return _fast_skeletonize(image)

def skeletonize ( image ) : image = image . astype ( np . uint8 ) if ( image . ndim != 2 ) : raise ValueError ( 'Skeletonize requires a 2D array' ) if ( not np . all ( np . in1d ( image . flat , ( 0 , 1 ) ) ) ) : raise ValueError ( 'Image contains values other than 0 and 1' ) return _fast_skeletonize ( image )
return the skeleton of a binary image .