// convert to unsigned int (this should work for boolean values)
image = image.astype(np.uint8)
// check some properties of the input image:
// - 2D
// - binary image with only 0"s and 1"s
After Change
if image.ndim == 2 and (method is None or method == "zhang"):
skeleton = skeletonize_2d(image)
elif image.ndim == 3 and method == "zhang":
raise ValueError("skeletonize method "zhang" only works for 2D "
"images.")
elif image.ndim == 3 or (image.ndim == 2 and method == "lee"):
skeleton = skeletonize_3d(image)
else:
raise ValueError("skeletonize requires a 2D or 3D image as input, "
"got {}D.".format(image.ndim))
return skeleton