EDGE DETECTION Dr. Amnach Khawne
Basic concept An edge in an image is defined as a position where a significant change in gray-level values occur. An edge can be defined as a boundary between two image regions having distinct characteristics according to some features (e.g., gray level, color, or texture). Source: Thomas B.Moeslun
Applications We may use edges – to measure the size of objects in an image; – to isolate particular objects from their background; – to recognize or classify objects. – to measure some dimensions of objects
Differences and edges Most edge detectors are fundamentally based on the use of gradient differential filters. Source: Thomas B.Moeslun
Differences and edges Source: Thomas B.Moeslun
Edge Types Step Edges Roof Edge Line Edges Source: S. Narasimhan
Perform Edge detection Calculus describes changes of continuous functions using derivatives. An image is a 2D function, so operators describing edges are expressed using partial derivatives. There are many ways to perform edge detection: - Gradient: The gradient method detects the edges by looking for the maximum and minimum in the first derivative of the image (e.g., Sobel, Prewitt, etc). - Laplacian: The Laplacian method searches for zero crossings in the second derivative of the image to find edges (e.g., LoG, Canny’s, etc). - Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc). - Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc). Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc). Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc). Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc). Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc). Gradient-based detectors (e.g., Sobel, Prewitt, etc). - Laplacian-based detectors (e.g., LoG, Canny’s, etc).
GRADIENT-BASED EDGE DETECTION
Gradient-Based Edge Detection
(a)Original image (b) horizontal intensity profile f(x) along the center image line (c ) first derivative f'{x) Source: Wilhelm Burger Mark J. Burge
Partial Derivatives and the Gradient A derivative of a multidimensional function taken along one of its coordinate axes is called a partial derivative-, for example, the partial derivatives the gradient vector (or "gradient" for short)
Partial Derivatives and the Gradient Gradient equation: Represents direction of most rapid change in intensity Gradient direction: The edge strength is given by the gradient magnitude
Differences of the edge function If we now plot the differences between each grey value and its predecessor from the ramp edge, we would obtain a graph
Grey values across edges
We can define the difference in three separate ways:
Discrete Edge Operators How can we differentiate a discrete image? Finite difference approximations: Convolution masks : Source: S. Narasimhan
Copyright © 2012 Elsevier Inc. All rights reserved.. The Design of Differential Gradient Operators
Comparing Edge Operators Gradient: Roberts (2 x 2): Sobel (3 x 3): Prewitt (3 x 3):
Sobel Edge Detector - Guidelines for Use The Sobel operator is slower to compute than the Roberts Cross operator. the operator less sensitive to noise. The operator also generally produces considerably higher output values for similar edges, compared with the Roberts Cross. The noise has increased during the edge detection. I +N (0,0.025) Edge detection of I +N (0,0.025) Edge detection of image without noise
The Sobel Operators Better approximations of the gradients exist – The Sobel operators below are commonly used
Compare the results of applying the Sobel operator with the equivalent Roberts Cross output Sobel operatorRoberts Cross output
Compare the results of applying the Sobel, Roberts, and Prewitt operators Roberts Sobel Prewitt I +N (0,0.025)
Compare the results of applying the Sobel, Roberts, and Prewitt operators Of the three filters, the Sobel filters are probably the best; they provide good edges, They perform reasonably well in the presence of noise.
Performance of Edge detection methods Source : Ikram Escandar Abdou
LAPLACIAN BASED EDGE DETECTION
Second difference To calculate a (central) second difference, take the backward difference of a forward difference
Second order partial derivatives: Laplacian : Convolution masks : or Discrete Edge Operators (more accurate) Source: S. Narasimhan
Laplacian Edge Operators Laplacian operator
2D Gaussian Edge Operators Laplacian of GaussianGaussianDerivative of Gaussian (DoG) Mexican Hat (Sombrero) is the Laplacian operator: Source: S. Narasimhan
Zero crossings
Matlab with the zerocross option of edge icz=edge(ic,'zerocross',l);
Edges and second dierences
Canny Edge Operator 1.Smooth image I with 2D Gaussian: 2.Find local edge normal directions for each pixel 3.Compute edge magnitudes 4.Locate edges by finding zero-crossings along the edge normal directions (non-maximum suppression)
The Canny Edge Detector original image (Lena)
magnitude of the gradient The Canny Edge Detector
After non-maximum suppression The Canny Edge Detector
Canny Edge Operator Canny with original The choice of depends on desired behavior –large detects large scale edges –small detects fine features
EDGE ENHANCEMENT
Edge enhancement The operation is variously called – edge enhancement, edge crispening, or unsharp masking. The idea of unsharp masking is to subtract a scaled unsharp version of the image from the original.
Edge enhancement >> I =imread(‘lena.bmp’); >> f=fspecial('average'); >> xf=filter2(f,I); >> xu=double(I)-xf/1.5; >> imshow(xu/70);
Edge enhancement
THE END