I am working with a mask of a cell, and want to skeletonize it in Python exactly as it is done in MATLAB.
The code in MATLAB is: I3A = bwskel(logical(I3A));
while in Python I am using I3A = medial_axis(I3A > 0)
. I am using medial_axis from skimage.morphology
because MATLAB’s documentation for bwskel
says the algorithm used is medial axis transform
.
For reference, I3A is an array for the mask where 0
is the mask and 1
is the current cell. As you will see below, the skeletonization is not the same. I also tried with just I3A = skeletonize(I3A > 0)
but that did not work either. Is there any way for me to get the same result as MATLAB?
In MATLAB, it produces this result (desired):
In Python, it gives this result: