You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[I use the medial_axis function, the result image has some double lines or small holes, then I count make a topology analysis!]
![demo picture] (http://data.imagepy.org/skebug.png "The medial_axis result and mine result")
I view the source code, and found the medial_axis function, sort by distance map, then use the skeletonize function's table to check if to remove the pixcel. But some times the sort cannot make sure the out-inside turn in extreme condition. So we need a new table for the media_axis. This is my code:
Build the table
fromscipy.ndimageimportlabel, generate_binary_structurestrc=generate_binary_structure(2, 2)
# check whether this pixcel can be removeddefcheck(n):
a= [(n>>i) &1foriinrange(8)]
a.insert(4, 0)
''' make the 3x3 unit 0 1 2 3 p 4 5 6 7 '''# if up, down, left, right all are 1, you cannot make a holeifa[1] &a[3] &a[5] &a[7]:returnFalsea=np.array(a).reshape((3,3))
# segmentsn=label(a, strc)[1]
# if sum is 0, it is a isolate point, you cannot remove it.# if sum is 1, it is a terminal point, you cannot remove it.# if number of segments = 2, you cannot split the line.# if number of segments > 2, it is a node, you cannot remove it.returna.sum()>1andn<2lut= [check(n) forninrange(256)]
'''like this:array([[0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1], [0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0]])'''
@yxdragon Sorry for not noticing this issue sooner; can you give us a bit more information here? I'm trying to understand what is wrong, and how you propose we fix it.
Description
[I use the medial_axis function, the result image has some double lines or small holes, then I count make a topology analysis!]
![demo picture] (http://data.imagepy.org/skebug.png "The medial_axis result and mine result")
I view the source code, and found the medial_axis function, sort by distance map, then use the skeletonize function's table to check if to remove the pixcel. But some times the sort cannot make sure the out-inside turn in extreme condition. So we need a new table for the media_axis. This is my code:
Build the table
Remove the pixcels
I think my code is right, but needs more test.
May I send a Pull Request after rewrite in cython?
Way to reproduce
[If reporting a bug, please include the following important information:]
skimage.__version__
)The text was updated successfully, but these errors were encountered: