500 likes | 782 Views
EE5358 Computer Vision. Edge Detection Muhammad Saleem Koul, SM IEEE. Why Edge Detection?. Courtesy [Gonzalez & Woods]. Why do we use Edge Detection?.
E N D
EE5358Computer Vision Edge Detection Muhammad Saleem Koul, SM IEEE
Why Edge Detection? Courtesy [Gonzalez & Woods]
Why do we use Edge Detection? • Changes or discontinuities in an image attribute such as luminance or texture are important primitive features of an image since they often provide an indication of the physical extent of objects within the image. • Edge detection contributes significantly to algorithms for feature detection, segmentation, and motion analysis. • We restrict ourselves here to intensity edges. Generally speaking, an edge is a significant, local change in the image intensity.
Why do we use Edge Detection? Courtesy: Eero Simoncelli, http://www.cns.nyu.edu/~eero • Edges are a distinct property of typical (real) images • Matlab example: randompicture
Edge Profile Real Image Randomly Generated Edge Profile
Edges in images • The brightness along a horizontal slice through the image is plotted. • Intensity changes due to edges are significant and local.
Origins of Edges An edge is a place where there is a rapid change in the brightness (or other property) of an image.
Edges in images • Discontinuities in the image intensity can be either • Step discontinuities, where the image intensity abruptly changes from one value on ones side of the discontinuity to a different value on the opposite side. • Line discontinuities, where the image intensity abruptly changes value but then returns to the starting value within some short distance.
Edge Profiles • Sharp discontinuities do not exist in real images because of low-frequency components or the smoothing introduced by image acquisition. • Step edges become ramp edges, and line edges become roof edges, where intensity changes are not instantaneous but occur over a finite distance. • We concentrate on step (ramp) edges because they are more commonly encountered.
Steps in edge detection • Algorithms for edge detection contain three steps: • Filtering: Gradient computation based on intensity values of only two points are susceptible to noise. Filtering reduces noise but there is a trade-o. between edge strength and noise reduction. • Enhancement: In order to facilitate the detection of edges, it is essential to determine intensity changes in the neighborhood of a pixel. Enhancement emphasizes pixels where there is a significant change in local intensity values and is usually performed by computing the gradient magnitude. • Detection: Many points in an image have a nonzero value for the gradient, but not all these points can be considered to be edges. Therefore, some method should be used to determine which points are edge points. Frequently, thresholding provides the criterion for detection.
Represents the direction of the most rapid change in intensity Edge strength is given by the Gradient Magnitude So the gradient is a vector with magnitude in the x and y directions equal to the respective partial derivatives We can find a closed form approximation of the gradient using Taylor’s series Gradient Operators
Gradient Operators • So how can we compute the image gradient efficiently? • Using our good old friend convolution!
Basic Edge Detection 1 Step Horizontal [-1 0 1] INPUT IMAGE Edge Enhancement Vertical [-1 0 1]T • But what about susceptibility to noise?
Basic Edge Detection 2 Step Noise Smoothing Horizontal [-1 0 1] INPUT IMAGE Edge Enhancement Vertical [-1 0 1]T
Edge Detection by Gradient Threshold The image gradient, as computed by the Sobel gradient operator or other means, highlights points on edges. Ref: Sobel, I., Feldman,G., "A 3x3 Isotropic Gradient Operator for Image Processing", presented at a talk at the Stanford Artificial Project in 1968 Irwin Sobel
The Sobel Operator • One of the most common edge detection is the Sobel operator. • Convolving each of these with the original image generates horizontal and vertical gradient images that are combined as before.
Comparing Edge Operators Good Localization Noise Sensitive Poor Detection Gradient: Roberts (2 x 2): Sobel (3 x 3): Sobel (5 x 5): Poor Localization Less Noise Sensitive Good Detection
Laplacian Operator • The edge detectors discussed earlier compute the first derivative and the presence of an edge point is assumed if the gradient magnitude is above a threshold. • This often results in the detection of too many edge points. A different approach would be to find only the points that have local maxima in gradient values and consider then edge points. • This means that at edge points, there will be a peak in the first derivative and, equivalently, there will be a zero crossing in the second derivative. Thus, edge points may be detected by finding the zero crossings in the second derivative of the image intensity.
Laplacian Operator Noisy image
Laplacian Operator • The Laplacian operator is seldom used by itself for edge detection. • It is unacceptably sensitive to noise. • However, it is useful in determining whether a given pixel is on the dark side or light side of an image. • It is used in conjunction with a Gaussian filter for edge detection. • This is known as a Laplacian of Gaussian (LOG) filter.
Laplacian of Gaussian Ellen Hildreth The Marr-Hildreth algorithm for edge detection is based on the zero-crossings of the Laplacian of the Gaussian operator. The Gaussian operator smoothes the image and the Laplacian operator computes the second derivative. Edges are found at zero-crossings of the resulting image. Ref: David Marr and Ellen Hildreth, “Theory of Edge Detection,” Proc. Royal Soc. of London, B 207, 187-217, 1980.
LAPLACIAN-OF-GAUSSIAN OPERATOR • A prominent source of performance degradation in the Laplacian operator is noise in the input image. • Noise effects can be minimized by smoothing the image prior to edge enhancement. • The Laplacian-of-Gaussian (LOG) operator smooths the image through convolution with a Gaussian-shaped kernel followed by applying the Laplacian operator. • The resultant zero crossings give the positions of the edges. • The fundamental characteristics of the LOG edge detector are • The smoothing filter is a Gaussian. • The enhancement step is the second derivative (Laplacian in two • dimensions). • The detection criterion is the presence of a zero crossing in the second derivative with a corresponding large peak in the first derivative. • The edge location can be estimated with sub-pixel resolution using linear interpolation.
Detecting zero-crossings • The edge locations occur at points in the LOG-filtered image where the value passes through zero. i.e., where there is a sign change. • The number of zero crossings is influenced by the size of the Gaussian; the greater the smoothing, the smaller the number of zero crossings. • A simple algorithm is to declare a pixel p to be zero crossing if any one of its 8-neighbors is of opssite sign. To restrict the detected zero crossings to the more significant ones, we can impose a threshold T.
Detecting zero-crossings Laplacian of Gaussian Laplacian of Gaussian operator Where is the edge? Zero-crossing on bottom graph.
Where is the edge?? Noise Suppression • Consider a single row or column of the image
Look for peaks in Solution: Smoothing Filter Where is the edge?
Thresholding • Effects of Thresholding. Results from threshold values of 50 and 100.
Canny Edge Detector John Canny The Canny Edge Detector is one of the most successful edge detection systems. Ref: John F. Canny, “A computational approach to edge detection,” IEEE Trans. Pattern Analysis and Machine Intelligence, Vol. 8, No. 16, pp. 679-698, Nov. 1986.
Canny edge detector • The gradient estimation techniques reviewed so far can yield edges with a width of several pixels • The Canny edge detector adds an additional refinement stage to address this • Estimate edge direction Es • Estimate edge strength Ed • Remove surplus edge pixels in the Ed direction • Hysteresis Thresholding
Edge detector performance • Criteria • Probability of false edges • Probability of missing edges • Error in estimation of edge angle • Mean square distance of edge estimate from true edge • Tolerance to distorted edges and other features such as corners and junctions
What we learned • Edges correspond to abrupt changes in image intensity • Edges can be detected by • Smoothing out image noise • Estimating the gradient of the image at every point to generate a “gradient” image • Thresholding the gradient image • Canny is an optimal edge detector, but when speed is critical we will rely on Sobel
Some Interesting Recent Research • J. Saraiva, L. P. C. Bandeira and P. Pina,”A STRUCTURED APPROACH TO AUTOMATED CRATER DETECTION”,Lunar and Planetary Science XXXVII (2006). • Junli Li, Gang Chen, Zheru Chi,” Image Coding Quality Assessment Using Fuzzy Integrals With a Three-Component Image Model”, IEEE TRANSACTIONS ON FUZZY SYSTEMS, VOL. 12, NO. 1, FEBRUARY 2004 • Yuan-Hui Yu, Chin-Chen Chang,“A new edge detection approach based on image context analysis”,Image and Vision Computing 24 (2006) 1090–1102
Impact Crater detection in Remote Sensed Planetary images templates Analysis Image Edge detected Proposed three-phased sequence to recognize impact craters. The original image is E1900566 (NASA/JPL/MSSS), with a spatial resolution of 245 meters/pixel. Ref: J. Saraiva et al.
Automatic Crator Detection: Algorithm • Apply Canny Edge Detector to the image • Apply Template matching algorithm • Automatically scale the template to match smaller and larger craters • Matching algorithm: Convolve the template over the image to find points of highest correlation.
Some Results >cratordetect Enter image filename: R0200837.gif Enter Edge threshold: 0.2 Courtesy: NASA-Mars Global Surveyor - Mars Orbiter Camera
Template matching on Complex Objects > b52detect Enter image filename: dohabase1.bmp Enter Edge threshold: 0.4 Enter template file: b52temp1.gif Enter Tuning Param [0-1]: 0.66 • Here we apply the same algorithm to aircrafts on a an airbase. We will try to identify a particular aircraft using its ‘outline’ or edge signature. (B-52 and B1-B Lancers) Courtesy: Google Earth
Why Template Matching in the EDGE DETECTED image? • The images would usually contain vast swathes of empty regions, which means efficient processing. • The template and the reference images are both binary images. This results in a remarkable improvement in processing. • If the color/texture of the object is not a concern. Hence the chances of errors due to shading or lighting effects are decreased.
Further improvements • The proposed Template matching algorithm does not account for rotated objects. The template has to be rotated 360os and has to be matched at each sample rotation ∆θ. • We can investigate efficient algorithms that need lesser number of template rotations. e.g. using morphological transformations or a translation and rotation aware image comparison algorithms.