File Exchange

image thumbnail

Better Skeletonization

version 1.0.0.0 (10.8 KB) by Nicholas Howe
Provides an alternative to the image toolbox skeletonization implemented in bwmorph.

23 Downloads

Updated 19 Jul 2007

View License

The files in this package comprise the Matlab implementation of a method for skeletonizing binary images. These are my own implementation
of a skeletonization method communicated to me by Alex Telea
(http://www.win.tue.nl/~alext/). See his papers for more details.

Skeletonization is (roughly speaking) the "thinning" of a binary image or silhouette to a one-pixel width spine. The image processing toolbox provides support for skeletonization via the bwmorph function, but its results do not always conform with our intuition. I have found that the approach used herein usually generates a more pleasing result.

There is also a routine for locating endpoints and junctions in skeletonized images.

(Note: This code has not been optimized for speed.)

Bug fix 7/18/07: In rare instances, isolated points would incorrectly be assigned an infinite value for skg.

Comments and Ratings (29)

Telea, A., van Wijk, J.J.: An Augmented Fast Marching Method for Computing Skeletons and Centerlines. Proc. IEEE VisSym (2002) 251–258

Hi
I tried to run it as
>> [skr,rad] = skeleton(lala);
where lala is my image but I get the following error
Attempt to execute SCRIPT skeleton as a function:
D:\EDEN\EDEN matlab\skeleton.m
and don't know why. What am I doing wrong?

Ben Kang

One thing not clear is how to set the threshold. Have to find it in trial-and-error manner. Once getting the threshold value, it gave me very good results.

BlueBee77

Amazing work

Works great - how about the function skelgrad to determine the local radius at each point? This would be very useful!

Nils

Matlab's built-in skeletonization is quirky as all hell and this is a necessary contribution, but this algorithm takes a beating on images over 512x512 with significant amounts of material to skeletonize. I cut it off after 5 minutes, which is pretty much unacceptable for a c++ file. You'll need to look elsewhere for high-throughput applications. I'll be trying this next:

http://www.mathworks.com/matlabcentral/answers/88284-remove-the-spurious-edge-of-skeleton

K

Could you tell me the name of the Alex Telea's paper of the references please?

Thank you but the url of Alex Telea's paper dont work.

William

John Booker

Anatoli

Has the tool & algorithm been published? If yes, would you please to mention the reference. Thanks a lot for the tool!

Nice work, but can I ask you something. How we may compute the threshold (you demostrate in demo file) automatically according to the given object nowing only its shape apriori? Can you give the exact reference of the algorithm?

Paul

Good

donny jason

i got it already. It works. Thank you

donny jason

I have try other compiler.I'm using mic studio professional 2008. It seems it is still the same..
how to solve it?

With regard to my question above (15 Sep 2009), I think I've figured it out -- it looks like the local radius output of the function skeleton() is actually the radius SQUARED. Take the sqrt to get the radius in pixels.

This package is very useful.

A question: does anyone know what the local radius values correspond to, or what units they are measured in? They are not in pixels.

It is very good. I have suggestions for additional features if you are interested in collaboration.

Casey Ta

For those having trouble compiling skeleton.m and anaskel.m, I had the same issue at first. The Lcc-win32 C 2.4.1 compiler that comes with MATLAB wouldn't compile these files. You'll have to try a different compiler. These files compiled just fine for me after I chose Microsoft Visual Studio 2008 in mex -setup.

Sravanti

I am a Matlab novice, having said that, this code also doesn't work for me, i ran the mex setup, chose a compiler, changed the file path names in skeleton.m and anaskel.m to the correct ones for the cpp files (from the download) - do I need to make any modifications in the C-code? how does it read the image?
I get lots of errors from the .cpp files

elden fisher

it works. you have to modify and run first skeleton.m and anaskel.m as they contain absolute path to the two cpp files for compilation.

Fadi Bazzi

This thing do not work right. Can someone help me? I am getting those errors:

??? Attempt to execute SCRIPT skeleton as a function:
C:\Users\Fkb\Documents\MATLAB\test\skeleton.m

Error in ==> demo at 9
imshow(bwmorph(skeleton(img)>35,'skel',Inf));

Luis Felipe

Very good.

Jinghong Low

Thanks for your contribution

Scooter NGC

Vincent Pelletier

Nice. For me it turns out that anaskel is the useful routine after all. I'm glad I tried it!

Arvin Fan

It works.

Updates

1.0.0.0

Bug fix.

In rare instances, isolated points would incorrectly be assigned an infinite value for skg.

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux