Computer Engineering

Edge Detection Lab


  • In an image, an edge is a curve that follows a path of rapid change in image intensity. Edges are often associated with the boundaries of objects in a scene. Edge detection is used to identify the edges in an image.


  • To find edges, you can use the edge function in MATLAB. This function looks for places in the image where the intensity changes rapidly, using one of these two criteria:

    1. Places where the first derivative of the intensity is larger in magnitude than some threshold.

    2. Places where the second derivative of the intensity has a zero crossing.


  • Edge function returns a binary image containing 1's where edges are found and 0's elsewhere.


  • The Canny method differs from the other edge-detection methods in that it uses two different thresholds (to detect strong and weak edges), and includes the weak edges in the output only if they are connected to strong edges. This method is therefore less likely than the others to be affected by noise, and more likely to detect true weak edges.


Instructions:

1. Download the following RGB image (right-click on the image and select Save image as...)

2. Use the rgb2gray function in MATLAB to convert the RGB image to a grayscale image.

3. Now detect edges in the image using the Canny edge detector. You may need to look for the edge function in the MATLAB help!

4. The final result should be the same as the following binary image. Move the slider to switch between the input and output images.