Unexpected result after excute morphology.skeletonize
Description:
in the zip file,there are two files.
1)temp_0.tif is the source file;2)temp_0_skel.tif is the result after excute method morphology.skeletonize. they are different.
wish for your reply
thanks
Way to reproduce:
from skimage import morphology import cv2 import matplotlib.pyplot as plt from skimage.util import invert import numpy as np file=r"D:\0Temp\jiangxiy\split\temp_0.tif" file_ex=r"D:\0Temp\jiangxiy\split\temp_0_skel.tif" imgGray = cv2.imread(file, flags=0) # flags=0 灰度图像
ret, imgBin = cv2.threshold(imgGray, 0, 255, cv2.THRESH_BINARY) # 二值化处理 imgBin[imgBin==255] = 1
skeleton01 = morphology.skeletonize(imgBin) skeleton = skeleton01.astype(np.uint8) * 255 cv2.imwrite(file_ex,skeleton)
plt.figure(figsize=(8, 6)) plt.subplot(121), plt.axis('off'), plt.title("origin") plt.imshow(imgBin, cmap='gray', vmin=0, vmax=255) plt.subplot(122), plt.title("skeleton"), plt.axis('off') plt.imshow(skeleton, cmap='gray', vmin=0, vmax=255) plt.tight_layout() plt.show()
Version information:
No response
The result seems reasonable to me @xiaozhu1988? Why do you think it is incorrect?
The result seems reasonable to me @xiaozhu1988? Why do you think it is incorrect? thanks for you replay.i have written a method with opencv,but the result is differenct.i also feel confued. the part in the red retangle is the different place.
"different" and "incorrect" are not the same thing. You could overlay the skeleton on the object to make it clearer what the skeletonization algorithm is doing. But there are many different skeletonization algorithms with different assumptions and naturally different results. To me, all of the results shown so far seem plausible.
Hello scikit-image core devs! There hasn't been any activity on this issue for more than 180 days. I have marked it as "dormant" to make it easy to find.
To our contributors, thank you for your contribution and apologies if this issue fell through the cracks! Hopefully this ping will help bring some fresh attention to the issue. If you need help, you can always reach out on our forum
If you think that this issue is no longer relevant, you may close it, or we may do it at some point (either way, it will be done manually).
I closing this. Please feel very welcome to reopen, in case you would like to add something or think this is still relevant. :)