Posted by
farhan khwaja
on
Monday, February 14, 2011
Read our
previous post
There are many operators in MATLAB for finding images
1. Sobers Operator
2. Roberts Operator
3. Prewitts Operator
4. Laplacian of Gaussian Method
5. ZeroCross Method, etc..
To use them in MATLAB there is a function called as edge(I).
By default, edge uses the Sobel method to detect edges but the following provides a complete list of all the edgefinding methods supported by this function:
Example :
Find the edges of an image using the Prewitt , SobeL and Roberts methods.
1. Sobers Operator
2. Roberts Operator
3. Prewitts Operator
4. Laplacian of Gaussian Method
5. ZeroCross Method, etc..
To use them in MATLAB there is a function called as edge(I).
Syntax :
BW = edge(I)
BW = edge(I,'sobel')
BW = edge(I,'prewitt')
BW = edge(I,'roberts') etc.
Description :
BW = edge(I) takes a grayscale or a binary image I as its input, and returns a binary image BW of the same size as I, with 1's where the function finds edges in I and 0's elsewhere.By default, edge uses the Sobel method to detect edges but the following provides a complete list of all the edgefinding methods supported by this function:
 The Sobel method finds edges using the Sobel approximation to the derivative. It returns edges at those points where the gradient of I is maximum.
 The Prewitt method finds edges using the Prewitt approximation to the derivative. It returns edges at those points where the gradient of I is maximum.
 The Roberts method finds edges using the Roberts approximation to the derivative. It returns edges at those points where the gradient of I is maximum.
 The Laplacian of Gaussian method finds edges by looking for zero crossings after filtering I with a Laplacian of Gaussian filter.
 The zerocross method finds edges by looking for zero crossings after filtering I with a filter you specify.
 The Canny method finds edges by looking for local maxima of the gradient of I. The gradient is calculated using the derivative of a Gaussian filter. The method uses two 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 fooled by noise, and more likely to detect true weak edges.
Example :
Find the edges of an image using the Prewitt , SobeL and Roberts methods.
i = imread('far.jpg');
I = rgb2gray(i);
BW1 = edge(I,'prewitt');
BW2= edge(I,'sobel');
BW3= edge(I,'roberts');
subplot (2,2,1);
imshow(I);
title('original');
subplot(2,2,2);
imshow(BW1);
title('Prewitt');
subplot(2,2,3);
imshow(BW2);
title('Sobel');
subplot(2,2,4);
imshow(BW3);
title('Roberts');
