Zhang-Suen Thinning
This is the implementation of the Zhang-Suen thinning algorithm using OpenCV. The algorithm is explained in "A fast parallel algorithm for thinning digital patterns" by T.Y. Zhang and C.Y. Suen. See the tutorial in opencv-code.com.
To use the thinning function, simply copy the thinning()
and thinningIteration()
function to your code. See the main()
block for an example on how to use the function.
Both thinning.cpp
and thinning.py
are similar, except that the former written in C++ and the latter in Python.
Contact
Feel free to ask question and report bugs to nash [at] opencv-code [dot] com.
Credit
Many thanks for DG (dangets [at] gmail [dot] com) for the pointer access code for improving the speed.