Thinning is the transformation of a digital image into a simplified, but topologically equivalent image. It is a type of topological skeleton, but computed using mathematical morphology operators.
Let                     E        =                  Z                      2                                  , and consider the eight composite structuring elements, composed by:
                              C                      1                          =        {        (        0        ,        0        )        ,        (        −        1        ,        −        1        )        ,        (        0        ,        −        1        )        ,        (        1        ,        −        1        )        }                 and 
                              D                      1                          =        {        (        −        1        ,        1        )        ,        (        0        ,        1        )        ,        (        1        ,        1        )        }                ,
                              C                      2                          =        {        (        −        1        ,        0        )        ,        (        0        ,        0        )        ,        (        −        1        ,        −        1        )        ,        (        0        ,        −        1        )        }                 and 
                              D                      2                          =        {        (        0        ,        1        )        ,        (        1        ,        1        )        ,        (        1        ,        0        )        }                and the three rotations of each by                               90                      o                                  ,                               180                      o                                  , and                               270                      o                                  . The corresponding composite structuring elements are denoted                               B                      1                          ,        …        ,                  B                      8                                  .
For any i between 1 and 8, and any binary image X, define
where                     ∖                 denotes the set-theoretical difference and                     ⊙                 denotes the hit-or-miss transform.
The thinning of an image A is obtained by cyclically iterating until convergence:
                    A        ⊗                  B                      1                          ⊗                  B                      2                          ⊗        …        ⊗                  B                      8                          ⊗                  B                      1                          ⊗                  B                      2                          ⊗        …                .