HIDIHO!

giving something back to the Flash community

Skeletonization

Tags: , , ,

cover
skeletonizing an image in AS3

This short explaination is more meaningful than any of my attempts so:

Skeletonization is the process of peeling off of a pattern as many pixels as possible without affecting the general shape of the pattern. In other words, after pixels have been peeled off, the pattern should still be recognized. The skeleton hence obtained must have the following properties:

  • as thin as possible
  • connected
  • centered

the explaination can be found there : http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/azar/skeleton.html#algorithm

this is a second take (already did it last year) this time I tried it with Vector instead of Array. It’s much faster ( 2 * ) yet still not convincing ; the patterns are not correct.
/!\UPDATED/!\Thanks to Cay’s corrections (see the comments), it works perfectly now !
big thanks to him

anyway I put this as such and will eventually update later.
press the red button:



and here’s my hilditch class:

you should run the

Hilditch.skeletonize( bitmapData );

until it returns twice the same value.
this is the basis to perform OCR and can be useful for shape recognition.
enjoy :)

Tags: , , ,

© 2009 HIDIHO!. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.