Git Product home page Git Product logo

skeletonization-by-zhang-suen-thinning-algorithm's Introduction

Zhang-Suen Thinning Algorithm, Python and Matlab Implementation

Algorithm Description:

This algorithm is used for thinning binary image. Two steps will be successively applied to the image.
Here arrange the eight neighbors of P1 in a clockwise order:

 P9 P2 P3 
 P8 P1 P4 
 p7 P6 P5 

Define N(P1) = the number of non-zore pixel neighbours of P1 ( = sum(P2 .. P9) )
Define S(P1) = the number of transitions from 0 to 1, (0 -> 1) in the sequence P2,P3,...,P8,P9,P2.

Step 1:

All pixels are tested and pixels satisfying all the following conditions (simultaneously) are just noted at this stage. After iterating over the image and collecting all the pixels satisfying all step 1 conditions, all these noted pixels are set to 0.

Condition 0: The pixel is 1 and has eight neighbours 
Condition 1: 2 < = N(P1) < = 6 
Condition 2: S(P1) = 1
Condition 3: P2 * P4 * P6 = 0 
Condition 4: P4 * P6 * P8 = 0 

Step 2:

All pixels are again tested and pixels satisfying all the following conditions are just noted at this stage. After iterating over the image and collecting all the pixels satisfying all step 2 conditions, all these noted pixels are again set to 0.

Condition 0: The pixel is 1 and has eight neighbours 
Condition 1: 2 < = N(P1) < = 6  
Condition 2: S(P1) = 1   
Condition 3: P2 * P4 * P8 = 0   
Condition 4: P2 * P6 * P8 = 0   

Iteration:

If any pixels were set in this round of either step 1 or step 2 then all steps are repeated until no image pixels are so changed. The last thing to note for this algorithm is that in each step the deletion of the noted points must be delayed until all the pixels of the image have been visited in order to avoid changing of pixels of the image during each step.

Reference:

Page48-50, "Character Recognition Systems: A Guide for Students and Practitioners" By Mohamed Cheriet, Nawwaf Kharma, Cheng-Lin Liu, Ching Suen

Implement Results:

Testing Environment:
Python 2.7 (scikit-image + matplotlib)
Matlab 2012

image image image

skeletonization-by-zhang-suen-thinning-algorithm's People

Contributors

linbojin avatar

Watchers

James Cloos avatar shivangpatel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.