ECE-S490 Digital Image Processing

Laboratory 3

Edge Detection

1Introduction

In this experiment, you will determine the edge maps of noise free and noisy images using different gradient based edge detection techniques and compare their performances. In the first part you will obtain the edge maps of noise free images using different Gradient based techniques i.e. Roberts, Prewitt and Sobel operators for different thresholds. In the second part you will compare the performances of Gradient based edge detectors for noisy images of different SNRs.

2Gradient based techniques

In this problem, you will analyze and implement different types of Gradient based edge detection techniques for different thresholds. Remember that the gradient of the original image I(m,n) in two orthogonal directions are obtained using a pair of masks h1(m,n) and h2(m,n).

g1(m,n)=h1(m,n)*I(m,n)g2(m,n)=h2(m,n)*I(m,n)

then the magnitude of the gradient is approximated as:

g(m,n)=|g1(m,n)|+|g2(m,n)|

Different approximations of the gradient operation together with the smoothing operation produce different pairs of masks. Essentially, it is those pair of masks that characterize the different gradient operators. The masks for Roberts, Prewitt and Sobel operators are given below:


Edge map (m,n) is obtained using the gradient g(m,n) as:

(m,n)=1 for g(m,n)>T

0Otherwise

Steps:

1. Download the original image I(m,n)=imread(‘rice.tif’) from the web page.

2. Write a Matlab function edgemap.m which will accept the original image, the thereshold percentage, α and the Gradient operators (Roberts, Prewitt or Sobel) as its inputs and produce the edge map (m,n) as its output. Just to give you an example:

function [Iem]=edgemap(I,α,’Roberts’)

In this function you will:

a. first calculate the g(m,n) using the appropriate masks h1(m,n) and h2(m,n) depending on the chosen operator,

b. then obtain the cumulative distribution function (cdf) of g(m,n) and select the threshold T that will produce %α of the pixels as edges. This can be thought as:

Pr{g(m,n)>T}=%α

c. finally obtain the edge map of the selected operator.

3. Obtain the edge maps of the Roberts, Prewitt and Sobel operators for α =5 and 20.

Section 2 Report:

Hand in:

  1. A print out of original image (rice.tif), edge maps after using Roberts, Prewitt and Sobel operators for α =5 on one page. (You can use subplot command in Matlab to plot more than one images on one page.)
  2. A print out of original image (rice.tif), edge maps after using Roberts, Prewitt and Sobel operators for α =20 on one page.
  3. Print out of your Matlab code.

3Performance Evaluation of the techniques

In this problem, you will evaluate the performance of different gradient based edge detection techniques. One of the methods of performance evaluation for edge detectors is to look at the detection rates at various noise levels. The detection rate can be defined by the rate of the number of edge pixels detected by a detection technique, nd and the total number of edge pixels, no which is known apriori:

D=nd/no

In the noiseless case all the operators are roughly equivalent. Here, we will test the performance of Roberts, Prewitt and Sobel operators for noisy images with SNR=20, 10, 5dB.

Steps:

1. Download noiseless.tif, noisySNR20.tiff, noisySNR10.tiff and noisySNR5.tiff from the web page.

2. Write a Matlab function perfeval.m that accepts the image, α, no (which can be obtained from the original noiseless image noiseless.tif) and the operator i.e. Roberts, Prewitt, etc. and produces the edge map and the performance measure D as its output. In this code you will

a. first obtain the edge map of the noisy image. In order to do this you can call the function edgemap.m that you wrote in section 2.

b. then count the number of edge pixels on the edge map, nd

c. finally calculate the performance measure D= nd/no

Section 3 Report:

Hand in:

  1. Print out of the noisy image, edge maps of Roberts, Prewitt, and Sobel operators (for α=5) and the performance measures of these operators on one page for each SNR=20, 10, 5dB.
  2. Discussion on the performance of each operator under noise for different SNRs.
  3. A print out of your Matlab code.