COMPSCI 775ST Assignment 1

Edge detection in colour images


Contents
Group Members

Christian Graf
Uli Schroeder

Back to Contents

Presentation

  1. Introduction

      Shape recognition is a major field in Image Processing and Computer Vision. There are various cases, where it can be very useful: i.e. quality assurance during manufacturing, security systems which check the customer's palm, face, etc. One problem is to do this with images of different intensity values (grey scale images). The problem becomes even more difficult if one extends it to colour images, which have a higher entropy and thus may provide better opportunities to detect certain features. Such features could also be edges.

  2. Assignment description

      The assignement is about edge detection in colour images, which can be done by using various methods, that are based on a pixel by pixel processing of operators on the image. We were introduced to some of them in the lecture. Now we should try how good (or bad) these operators work. To do so, we implemented and compared two: Sobel and Laplace-of-Gaussian (LoG).

      Implementation: Our aim was to write suitable and easy-to-read classes which could be used for every kind of input images, regardless of size and data format (which is limited through the file types the Halcon library supports) and which could be easily handled with different settings for the internal parameters (operators' size, input and output file, etc.).
      The Sobel operator is easy to program as it can be represented as a matrix of constant size, which contains only constant values. We've done a straight-forward implementation. The Sobel operator is a 3x3 array with the according values in it. It's aplied to each of the image's colour channels (RGB) which are represented in HByteImage arrays. To remove some noise (especially white and salt'n'peper noise) we did a smoothing with the Median operator before using the Sobel matrix. This was done with the built-in method of Halcon. After the resulting edges within each colour channel were derived, we combined the pictures again. This was done by looking if an edge has been detected in at least two of the three channels. The final result is a monochromatic picture of the detected edges.
      The LoG filter was more difficult to implement. The matrix (kernel) is not set to a distinct size and the values in the operator's matrix have to be determined for every size again. As our program should only be restrictive in the most convenient way (see objectives above) we had to find a solutions which allows variable sized arrays and in connection to that we had to program the funtion to fill the matrix with the correct values. Therefore we used double-pointered variables, which can be of arbitrary size. They can be addressed just like a two-dimensional array. The mathematical formula to compute the kernel values was then taken from [KSK98]. Another problem was, that the LoG operators computes either float or double values which can be both, positive and negative. A HByteImage object cannot store that information. All values get casted to unsigned byte values. Thus we used the double- pointered variables here as well to store the computed results for each channel. An edge is detected if the multiplication of two neighbouring pixels is negative. This is checked in horizontal and vertical direction. The combination of all three colour channels is done in the same way as with the Sobel operator.

      Comparision: Some words to the advantages (+) and disadvantages (-) of the two implemented operators:
      Sobel:
        + straight edges (going vertical or horizontal) are detected quite well
        + easy to implement and easy to handle (no parameters, except the threshold, have to be set)
        - round edges and diagonal edges are not detected very good
        - inhomogenous regions within the image are processed with artefacts (an additional smoothing should be done before the edge detection)
      LoG:
        + processes noise images as well as clear images
        + all directions of edges are detected with constant reliability
        - clear images and the edges within are blurred through the Gaussian, the clearness decreases and thus the detection is worse than without any smoothing

  3. Experiment results

      We have done a comprehensive test with our operators, covering all the images and a broad variety of parameter settings: with and without additional blurring and the threshold for Sobel, different theta values and different sizes of the LoG-operator. This results in over 90 images which we cannot include in this presentation, but you can request them via e-mail from us. We have chosen three images (brick.0004, buildings.0003 and fv305) for which we want to present our findings. They have been chosen because of the different kind of edges within each of them. brick.004 is a almost uniquely constant coloured image with inhomogenous regions seperated by darker but not continous lines in arbitrary directions. buildings.0003 is a very clear image with distinct edges and very homogenous regions. Fv305 is a more colourful picture. Its very dark and it's hard to recognize structures and shapes out of it. It has no straight lines.

      Performance of the operators:
      Sobel:
        Notation:
          1) with small threshold (=0.5)
          2) with high threshold (=1.0)
        Brick.0004:
          1) all edges, but also noise in the 'blank' regions (image)
          2) all edges distinguishable, fewer noise (image)
        Building.0003:
          1) good image even with low threshold, a bit noise in it (image)
          2) less noise, clear edges (image)
        Fv305:
          1) lines, but no shapes (apples) were obtained (image)
          2) almost no edges at all (image)

      LoG:
        Notation:
          1) theta is small and constant (=1.5), matrix size changes (13x13, 21x21)
          2) theta is big and constant (=2.5), matrix size changes (13x13, 21x21)
          3) theta changes (1.5, 2.5), matrix static (21x21)
          The change is always from small to higher setting within the single experiments of type (1),(2) or (3).
        Brick.0004:
          1) no useable edge detection, noise over the whole image (small matrix size), (big matrix size)
          2) change in image, clear edges, but more noise (small matrix size), (big matrix size)
          3) less noise and distrubing artifacts (small theta), (big theta)
        Buildings.0003:
          1) no great differences in the images (small matrix size), (big matrix size)
          2) output stays almost identical, edge image not enhanced (small matrix size), (big matrix size)
          3) noise disappears, edges better distinguishable (small theta), (big theta)
        Fv305:
          1) no recognisable edges detected (small matrix size), (big matrix size)
          2) regardless of the matrix size nothing usefull is detected (small matrix size), (big matrix size)
          3) artifacts vanish, but edges as well, all content is slowly disappearing (small theta), (big theta)

  4. Conclusions, remarks or discussions

      What surprised us was the fact that especially with the LoG the results sometimes change with little modifications in the parameters, sometimes a signifiant modification results in almost no change in the output. We really had to try what method and what parameters worked best. The quality also depended very much on the source image we used.

  5. Source code

Back to Contents

Answers to Questions

  1. What are the merits and demerits of the selected edge detection methods?

      (see Presentation)

  2. Under what conditions do you expect the selected edge detection method to better perform?
    1. Sobel: clear, unnoisy images with mostly straight vertical or horizontal lines
      LoG: noise images that can also contain round structures

  3. Discuss the colour models you have used and why you have selected them.
    1. RGB: We have choosen RGB to have the opportunity to get a three channel image. Each of these channels can be processed on its own, so one has the chance to detect the edges in the channels sepereatly. The problem is, that it's perhaps not sufficient to have an edge only in one of the decomposed images You have to decide on an appropiate method to combine the results from the single images. One can set different weights for the single colour image to contribute to the result. Thus it's possible to 'fine tune' the outcome even more. This is an advantage but in the same time a disadvantage: the weights you set for each colour depend on the image and the application (what is to detect?). There is no rule which settings suits best to a specific problem. Often it's just trial and error to find the right parameters.

  4. With the chosen edge detection method, display and comment the obtained results.
    1. (see Presentation)

  5. Compare the results to your expectations of the chosen edge operators.
    1. As we already had an overview over the different edge detection operators, we had no special expectations towards the implemented operators. We knew a few things about their advantages and disadvantages. In the end we've seen that they behaved like we were told before..

Back to Contents


References

[KSK98] Klette, Schlüns, Koschan: Computer Vision, Singapore 1998

Back to Contents