Page 141 -
P. 141

Chapter 3 ■ Digital Morphology   115


                               placed outside of the bounds of the image. The complement operator produces
                               an image of the same size as the image being complemented, although when
                               using sets this would not be so. This problem can be avoided by copying the
                               input image to a bigger image before doing the complement.














                                       (a)                (b)                (c)






                                                                                              (g)






                                       (d)                (e)                (f)
                               Figure 3.18: Illustration of the hit-and-miss transform. (a) The image to be examined. (b)
                               Foreground-structuring element for the location of upper-right corners. (c) The erosion of
                               (a) by (b) — the ‘‘hit’’ portion of the computation. (d) The complement of (a). (e) The
                               background-structuring element, showing that the three pixels to the upper right of the
                               corner must be background pixels. (f) The erosion of (d) by (e), or the ‘‘miss’’ portion of
                               the computation. (g) The intersection of (c) and (f) — the result, showing the location of
                               each of the two upper-right corners in the original image.


                                 The MAX program that performs a hit-and-miss transform is:

                                 // Hit-and-miss transform
                                 image a, se1, se2;
                                 begin
                                        do a << “$1“;
                                        se1 := {[5,5], [2,1], “0000000000110000100000000“};
                                        se2 := {[5,5], [2,1], “0000001100001000000000000“};
                                        a := (a--se1)*(~a -- se2);
                                        message a;
                                 end;
   136   137   138   139   140   141   142   143   144   145   146