CS7321 Winter 1998


PS2
Edge detection

Presented by Jim Rowan


  • Overview:
  • Matlab routines used to generate the images:
  • The original image, the modified images and the Matlab routines that modified them:
  • The images demonstrating the Roberts method of edge detection:
  • The images demonstrating the Sobel method of edge detection:
  • The images demonstrating the Prewitt method of edge detection:
  • The images demonstrating the Zerocrossing method of edge detection:

  • Overview:


    For problem set 2 I decided to attempt to recreate the images found on pages 150 through 153 in the chapter of the text on edge detection.
    Various ways of detecting edges were attempted under various image conditions. The primary methods of edge detection investigated were the Roberts cross operator, the Sobel operator, the Prewitt operator and an additional Matlab edge function method called zerocrossing.

    The image was that of a connecting rod from a piston engine that was placed on a plain white background. Each of the above mentioned edge detection methods were applied to:
    1) An unaltered, uncorrupted image
    2) A filtered, uncorrupted image
    3) An image corrupted with Gaussian noise and
    4) An image corrupted with noise and then filtered.

    Each of the edge detection methods were tried in their various available configurations. All of them could be used either without specifying a threshold allowing Matlab to calculate it for you or with a specific threshold supplied as an argument. For each of the methods on each of the images were tried using the threshold calculated by Matlab and, in most cases, several specific thresholds.

    Additionally the zerocrossing edge detector was configured with threshold = 0 to produce an output image with closed contours and with various user defined filters.

    The results are mixed as can be seen in the images that are included in this document but generally allowing the edge function to calculate the threshold resulted in better edge detection.


    Matlab routines used to generate the images:


    This is the code performs the Roberts edge detection.
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    This is the code performs the Sobel edge detection.
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    This is the code performs the Prewitt edge detection.
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The seven subsequent images are calculated using thresholds of:
    0.010, 0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    This is the code performs 1x2 Gx Zerocrossing edge detection.
    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 1x2 Gx mask.
    The fourth image that this routine produces specifies the 1x2 Gx mask and a threshold of 0.12109375.
    This is the code performs 2x1 Gy Zerocrossing edge detection.
    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 2x1 Gx mask.
    The fourth image that this routine produces specifies the 2x1 Gx mask and a threshold of 0.12109375.
    This is the code performs 2x2 Gx Zerocrossing edge detection.
    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 2x2 Gx mask.
    The fourth image that this routine produces specifies the 2x2 Gx mask and a threshold of 0.12109375.
    This is the code performs 2x2 Gy Zerocrossing edge detection.
    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 2x2 Gy mask.
    The fourth image that this routine produces specifies the 2x2 Gy mask and a threshold of 0.12109375.

    The original image, the modified images and the Matlab routines that modified them:


    This is the raw image, unfiltered and no additional noise:


    This is the image, filtered with no additional noise:

    This code performs a Gaussian 7x7 filtering operation on the image.

    This is the image, unfiltered with additional noise:

    This code inserts Gaussian noise into the image.

    This is the image, filtered with additional noise:

    This code inserts Gaussian noise and then performs a Gaussian 7x7 filtering operation on the image.

    Roberts:


    Roberts images, no noise, no filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Roberts images, no noise, Gaussian filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Roberts images, Gaussian noise, no filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Roberts images, Gaussian noise, Gaussian filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    The images demonstrating the Sobel method of edge detection:


    Sobel images, no noise, no filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Sobel images, no noise, Gaussian filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Sobel images, Gaussian noise, no filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Sobel images, Gaussian noise, Gaussian filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The six subsequent images are calculated using thresholds of:
    0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    The images demonstrating the Prewitt method of edge detection:


    Prewitt images, no noise, no filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The seven subsequent images are calculated using thresholds of:
    0.010, 0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Prewitt images, no noise, Gaussian filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The seven subsequent images are calculated using thresholds of:
    0.010, 0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Prewitt images, Gaussian noise, no filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The seven subsequent images are calculated using thresholds of:
    0.010, 0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    Prewitt images, Gaussian noise, Gaussian filtering:
    The first image this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The seven subsequent images are calculated using thresholds of:
    0.010, 0.120, 0.12109375, 0.125, 0.130, 0.135, 0.14

    The images demonstrating the Zerocrossing method of edge detection:


    Zerocrossing images, no noise, no filtering:


    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 1x2 Gx mask.
    The fourth image that this routine produces specifies the 1x2 Gx mask and a threshold of 0.12109375.
    The fifth image that this routine produces specifies the 1x2 Gy mask.
    The sixth image that this routine produces specifies the 1x2 Gy mask and a threshold of 0.12109375.
    The seventh image that this routine produces specifies the 2x2 Gx mask.
    The eighth image that this routine produces specifies the 2x2 Gx mask and a threshold of 0.12109375.
    The ninth image that this routine produces specifies the 2x2 Gy mask.
    The tenth image that this routine produces specifies the 2x2 Gy mask and a threshold of 0.12109375.


    Zerocrossing images, no noise, Gaussian filtering:


    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 1x2 Gx mask.
    The fourth image that this routine produces specifies the 1x2 Gx mask and a threshold of 0.12109375.
    The fifth image that this routine produces specifies the 1x2 Gy mask.
    The sixth image that this routine produces specifies the 1x2 Gy mask and a threshold of 0.12109375.
    The seventh image that this routine produces specifies the 2x2 Gx mask.
    The eighth image that this routine produces specifies the 2x2 Gx mask and a threshold of 0.12109375.
    The ninth image that this routine produces specifies the 2x2 Gy mask.
    The tenth image that this routine produces specifies the 2x2 Gy mask and a threshold of 0.12109375.


    Zerocrossing images, Gaussian noise, no filtering:


    The first image that this routine produces is calculated using the threshold calculated by the Matlab edge function.
    The second image that this routine produces is one of closed contours.
    The third image that this routine produces specifies the 1x2 Gx mask.
    The fourth image that this routine produces specifies the 1x2 Gx mask and a threshold of 0.12109375.
    The fifth image that this routine produces specifies the 1x2 Gy mask.
    The sixth image that this routine produces specifies the 1x2 Gy mask and a threshold of 0.12109375.
    The seventh image that this routine produces specifies the 2x2 Gx mask.
    The eighth image that this routine produces specifies the 2x2 Gx mask and a threshold of 0.12109375.
    The ninth image that this routine produces specifies the 2x2 Gy mask.
    The tenth image that this routine produces specifies the 2x2 Gy mask and a threshold of 0.12109375.


    Zerocrossing images, Gaussian noi