Page 261 -
P. 261

Chapter 6 ■ Thinning   235


                               each boundary pixel individually. Then each line would exert a single force
                               on each pixel, rather than many forces. In addition, the visibility calculation
                               can be simplified by using a simple distance threshold. Line segments further
                               than d units away would not contribute a force.
                                 Figure 6.24 shows the forces computed for a hand-printed 8, and gives the
                               skeleton as determined by the force-based method. For comparison purposes
                               the skeleton found by the Zhang-Suen algorithm is shown also.










                                                                                             (b)










                                                                                             (c)










                                                            (a)                              (d)
                               Figure 6.24: Force-based thinning applied to a handprinted 8. (a) The forces at each
                               pixel, where force is proportional to the length of the line drawn from the pixels, and
                               direction is normal to them. (b) The original figure. (c) Thinned using Zhang-Suen. (d)
                               Force-based skeleton.


                               6.7 Source Code for Zhang-Suen/Stentiford/Holt
                               Combined Algorithm


                               / *  Zhang & Suen’s thinning algorithm  * /
                               #define MAX
                               #include “lib.h“
                               #include <math.h>
                               #define TRUE 1
   256   257   258   259   260   261   262   263   264   265   266