Page 70 -
P. 70

44    Chapter 2 ■ Edge-Detection Techniques



                           The derivative with respect to x is therefore

                                                                        x 2
                                                               x
                                                                   −  2σ 2
                                                     G (x) = −     e                      (EQ 2.22)
                                                               σ  2
                           In two dimensions, a Gaussian is given by


                                                                     2  2
                                                                   x +y
                                                                 −  2σ 2
                                                               2
                                                     G(x, y) = σ e                        (EQ 2.23)

                           and G has derivatives in both the x and y directions. The approximation to
                           Canny’s optimal filter for edge detection is G’, and so by convolving the input
                           image with G’,we obtain animage E that has enhanced edges, even in the pres-
                           ence of noise, which has been incorporated into the model of the edge image.
                             A convolution is fairly simple to implement, but is expensive computation-
                           ally, especially a two-dimensional convolution. This was seen in the Marr
                           edge detector. However, a convolution with a two dimensional Gaussian can
                           be separated into two convolutions with one-dimensional Gaussians, and the
                           differentiation can be done afterwards. Indeed, the differentiation can also
                           be done by convolutions in one dimension, giving two images: one is the x
                           component of the convolution with G’ and the other is the y component.
                             Thus, the Canny edge-detection algorithm to this point is:

                             1. Read in the image to be processed, I.

                             2. Create a one-dimensional Gaussian mask G to convolve with I.The
                                standard deviation(s) of this Gaussian is a parameter to the edge detector.
                             3. Create a one-dimensional mask for the first derivative of the Gaussian in
                                the x and y directions; call these G x and G y . The same s value is used as
                                in step 2.

                             4. Convolve the image I with G along the rows to give the x component
                                image I x , and down the columns to give the y component image I y .
                             5. Convolve I x with G x to give I x ’, the x component of I convolved with the
                                derivative of the Gaussian, and convolve I y with G y to give I y ’.
                             6. Compute the magnitude of the edge response (i.e., if you want to view the
                                result at this point) by combining the x and y components. The magnitude
                                of the result can be computed at each pixel (x,y) as:


                                                                     2


                                                    M(x, y) =  I x (x, y) + I (x, y) 2
                                                                         y
   65   66   67   68   69   70   71   72   73   74   75