Page 147 -
P. 147

Chapter 3 ■ Digital Morphology   121


                                        count := 0;
                                        loop
                                         count := #a + count;
                                         b := (a--L1) + (a--L2) + (a--L3) + (a--L4);
                                         exit whenb=0;
                                         a:= b;
                                        end;
                                        message  ˝ Number of 8 regions is ˝; message count; message;
                                 end;

                                 This program counts eight regions in Figure 3.22e, which is correct for
                               8-connected regions. It also counts two regions in Figure 3.11a, which is also
                               correct. The algorithm for 4-connected regions is the same but uses different
                               structuring elements.



                               3.4 Grey-Level Morphology


                               The use of multiple grey levels introduces an enormous complication, both
                               conceptually and computationally. A pixel can now have any integer value, so
                               the nice picture of an image being a set disappears. There is also some question
                               about what dilation, for example, should mean for a grey-level image. Rather
                               than being strictly mathematical here, we will take a more intuitive approach,
                               in the hope that the result will make sense.
                                 Consider the image of a line in Figure 3.23a.















                                     (a)            (b)               (c)                  (d)
                               Figure 3.23: Grey-scale dilation. (a) A bi-level image of a line. (b) Binary dilation of (a)
                               by simple. (c) A grey-scale image of a line; background is 0, and the line pixels have the
                               value 20. (d) This is what the grey line should look like after a dilation.


                                 This is a bi-level image, and the dilation of this image by the simple
                               structuring element can be computed (Figure 3.23b). Now imagine that instead
                               of having levels 0 and 1, the pixels in the line have the value 20 and the
                               background is 0. What should a dilation of this new image by simple look
   142   143   144   145   146   147   148   149   150   151   152