Thursday, September 14, 2017

Edge Detection



Edge Detection

- Identifying discontinuities in an image.

- It involves convolution of image with an 2D filter (Classical method)

- Some of the classical edge detection filters are given below for references.

a) Sobel Filter



- It is applied separately over an image to detect vertical and horizontal edges and combine them to obtain resultant image.

b) Roberts Filter


- It is simple and quick to compute edges from an image.

c) Prewitts Filter



d) Laplacian of Gaussian Filter


- Measures 2nd order derivative of an image which highlights the region around rapid discontinuity in an image.

- The lapacian filter is sensitive to noise and hence to reduce sensitivity to noise, the input image has to be smoothen by means of smoothening filters like Gaussian filter before applying laplacian filter.

- An example of 5 x 5 Gaussian mask having σ=1.4 is shown below

e) Canny Filter
- It is considered to be most optimum edge detection tool among all techniques discussed above.

- It involves five steps

i. Smoothening

- To avoid that noise is mistakenly considered as edges, input images are subjected to smoothening initially before applying for edge detection. Gaussian filter discussed above is most widely used for smoothening.

ii.Gradient Detection

- Use Sobel filter to find approximate gradient detection in an smoothened image.

iii. Suppression of non maxima

- This step is to bring sharp edges from the blurred edges in the image.

iv. Dual Thresholding


- This is to strengthen the edges

- It involves classification of edges

      (a) Strong edge if the edge value is greater than high threshold value.

      (b) Weak edge if the edge value is between high threshold and low threshold value.

      (c) Suppress edge if is below low threshold value.

v. Edge tracking

- Retain strong edges

- If weak edges are connected to strong edges, then it is retained else suppressed.

- Edges are tracked by means of BLOB analysis.

      (a) Edge pixels are divided in to blobs.

      (b) If BLOB contains at least one strong edge retain it else suppress.

Matlab Code:

clc;

clear all;

close all;

input_image=imread('cameraman.tif');

sobel_output = edge(input_image,'Sobel');

Roberts_output = edge(input_image,'Roberts');

Prewitt_output = edge(input_image,'Prewitt');

Laplacian_output = edge(input_image,'log');

Canny_output = edge(input_image,'Canny');

subplot(2,3,1);

imshow(input_image);

title('input image');

subplot(2,3,2);

imshow(sobel_output);

title('Sobel');

subplot(2,3,3);

imshow(Roberts_output);

title('Roberts');

subplot(2,3,4);

imshow(Prewitt_output);

title('Prewitt');

subplot(2,3,5);

imshow(Laplacian_output);

title('Laplacian of Gaussian(LOG)');

subplot(2,3,6);

imshow(Canny_output);

title('Canny');


No comments:

Post a Comment