1 / 84

Edge Detection & Image Segmentation

Edge Detection & Image Segmentation. Dr . Md. Altab Hossain Associate Professor Dept. of Computer Science & Engineering, RU. Edge Detection. Element of Image Analysis. Preprocess Image acquisition, restoration, and enhancement. Intermediate process

ulfah
Download Presentation

Edge Detection & Image Segmentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Edge Detection & Image Segmentation Dr. Md. Altab Hossain Associate Professor Dept. of Computer Science & Engineering, RU

  2. Edge Detection

  3. Element of Image Analysis Preprocess Image acquisition, restoration, and enhancement Intermediate process Image segmentation and feature extraction High level process Image interpretation and recognition

  4. Image Attributes for Image Segmentation 1.Similarity properties of pixels inside the object are used to group pixels into the same set. 2. Discontinuity of pixel properties at the boundary between object and background is used to distinguish between pixels belonging to the object and those of background. Discontinuity: Intensity change at boundary Point, Line, Edge Similarity: Internal pixels share the same intensity

  5. Point Detection 0 -1 -1 -1 -1 0 -1 -1 4 8 -1 -1 -1 0 -1 -1 -1 0 • We can use Laplacian masks for point detection. • Laplacian masks have the largest • coefficient at the center of the mask • while neighbor pixels have an • opposite sign. • This mask will give the high response to the object that has the • similar shape as the mask such as isolated points. • Notice that sum of all coefficients of the mask is equal to zero. • This is due to the need that the response of the filter must be zero • inside a constant intensity area

  6. Point Detection • Point detection can be done by applying the thresholding function: Location of porosity X-ray image of the turbine blade with porosity Laplacian image After thresholding (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

  7. Line Detection • Similar to point detection, line detection can be performed • using the mask the has the shape look similar to a part of a line • There are several directions that the line in a digital image can be. • For a simple line detection, 4 directions that are mostly used are • Horizontal, +45 degree, vertical and –45 degree. Line detection masks (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

  8. Line Detection Example Binary wire bond mask image Absolute value of result after processing with -45 line detector Result after thresholding Notice that –45 degree lines are most sensitive (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

  9. Definition of Edges • Edges are significant local changes of intensity in an image. • Edges typically occur on the boundary between two different regions in an image.

  10. surface normal discontinuity depth discontinuity color discontinuity illumination discontinuity What Causes Intensity Changes? • Geometric events • surface orientation (boundary) discontinuities • depth discontinuities • color and texture discontinuities • Non-geometric events • illumination changes • specularities • shadows • inter-reflections

  11. Why is Edge Detection Useful? Important features can be extracted from the edges of an image (e.g., corners, lines, curves). These features are used by higher-level computer vision algorithms (e.g., recognition).

  12. Where are the edges?

  13. Edge Descriptors • Edge normal: unit vector in the direction of maximum intensity change. • Edge direction: unit vector to perpendicular to the edge normal. • Edge position or center: the image position at which the edge is located. • Edge strength: related to the local image contrast along the normal.

  14. Modeling Intensity Changes • Step edge: the image intensity abruptly changes from one value on one side of the discontinuity to a different value on the opposite side. • Ramp edge: a step edge where the intensity change is not instantaneous but occur over a finite distance.

  15. Modeling Intensity Changes (cont’d) • Ridge edge: the image intensity abruptly changes value but then returns to the starting value within some short distance (i.e., usually generated by lines). • Roof edge: a ridge edge where the intensity change is not instantaneous but occur over a finite distance (i.e., usually generated by the intersection of two surfaces).

  16. Main Steps in Edge Detection (1) Smoothing: suppress as much noise as possible, without destroying true edges. (2) Enhancement: apply differentiation to enhance the quality of edges (i.e., sharpening). (3) Thresholding: determine which edge pixels should be discarded as noise and which should be retained (i.e., threshold edge magnitude). (4) Localization:determine the exact edge location. sub-pixelresolution might be required for some applications to estimate the location of an edge to better than the spacing between pixels.

  17. 1st derivative 2nd derivative Edge Detection Using Derivatives • Often, points that lie on an edge are detected by: (1) Detecting the local maxima or minima of the first derivative. (2) Detecting the zero-crossings of the second derivative.

  18. Smoothed Step Edge and Its Derivatives 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 0.06 0.04 0.02 0 -0.02 -0.04 -0.06 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 -3 x 10 5 4 3 2 1 0 -1 -2 -3 -4 -5 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 Edge Edge Gray level profile Intensity Minimum point The 1st derivative Maximum point Zero crossing + + The 2nd derivative - -

  19. Image Derivatives • How can we differentiate a digital image? • Option 1: reconstruct a continuous image, f(x,y), then compute the derivative. • Option 2: take discrete derivative (i.e., finite differences) Consider this case first!

  20. Edge Detection Using First Derivative 1D functions (not centered at x) (centered at x) (upward) step edge

  21. Edge Detection Using Second Derivative • Approximate finding maxima/minima of gradient magnitude by finding places where: • Can’t always find discrete pixels where the second derivative is zero – look for zero-crossing instead.

  22. Edge Detection Using Second Derivative (cont’d) 1D functions: (centered at x+1) Replace x+1 with x (i.e., centered at x):

  23. Edge Detection Using Second Derivative (cont’d)

  24. Edge Detection Using Second Derivative (cont’d)

  25. Noise Effect on Images Edges • First column: images and gray-level profiles of a ramp edge corrupted by random Gaussian noise of mean 0 and  = 0.0, 0.1, 1.0 and 10.0, respectively. • Second column: first-derivative images and gray-level profiles. • Third column : second-derivative images and gray-level profiles.

  26. Edge Detection Using First Derivative (Gradient) • The first derivate of an image can be computed using the gradient: 2D functions:

  27. Gradient Representation • The gradient is a vector which has magnitude and direction: • Magnitude: indicates edge strength. • Direction: indicates edge direction. i.e., perpendicular to edge direction (approximation) or

  28. Approximate Gradient • Approximate gradient using finite differences:

  29. Approximate Gradient (cont’d) • Cartesian vs pixel-coordinates: - j corresponds to x direction - i to -y direction

  30. Approximating Gradient (cont’d) • We can implement and using the following masks: (x+1/2,y) good approximation at (x+1/2,y) (x,y+1/2) * * good approximation at (x,y+1/2)

  31. Approximating Gradient (cont’d) • A different approximation of the gradient: • 3 x 3 neighborhood:

  32. Approximating Gradient (cont’d) • and can be implemented using the following masks:

  33. Another Approximation • Consider the arrangement of pixels about the pixel (i, j): • The partial derivatives can be computed by: • The constant cimplies the emphasis given to pixels closer to the center of the mask. 3 x 3 neighborhood:

  34. Prewitt Operator • Setting c = 1, we get the Prewitt operator:

  35. Sobel Operator • Setting c = 2, we get the Sobel operator:

  36. Edge Detection Steps Using Gradient

  37. An Example

  38. An Example (cont’d)

  39. Comparison of Gradient based Operator

  40. The Canny Edge Detector

  41. The Canny Edge Detector • Canny – smoothing and derivatives:

  42. The Canny Edge Detector • Canny – gradient magnitude: image gradient magnitude

  43. Practical Issues • Choice of threshold. gradient magnitude low threshold high threshold

  44. Practical Issues (cont’d) • Edge thinning and linking.

  45. Criteria for Optimal Edge Detection • (1) Good detection • Minimize the probability of false positives (i.e., spurious edges). • Minimize the probability of false negatives (i.e., missing real edges). • (2) Good localization • Detected edges must be as close as possible to the true edges. • (3) Single response • Minimize the number of local maxima around the true edge.

  46. Edge Contour Extraction • Edge detectors typically produce short, disjoint edge segments. • These segments are generally of little use until they are aggregated into extended edges. • We assume that edge thinning has already be done (e.g., non-maxima suppression). • Two main categories of methods: • local methods (extend edges by seeking the most "compatible" candidate edge in a neighborhood). • global methods (more computationally expensive - domain knowledge can be incorporated in their cost function).

  47. Edge Contour Extraction

  48. Local Processing Methods • Edge Linking using neighbor

  49. Local Processing Methods • Contour extraction using heuristic search • A more comprehensive approach to contour extraction is based on graph searching. • Graph representation of edge points: • (1) Edge points at position picorrespond to graph nodes. • (2) The nodes are connected to each other if local edge linking rules are satisfied.

  50. Local Processing Methods • Contour extraction using heuristic search – cont. • The generation of a contour (if any) from pixel pAto pixel pB the generation of a minimum-cost path in the directed graph. • A cost function for a path connecting nodes p1 = pAto pN= pBcould be defined as follows: • Finding a minimum-cost path is not trivial in terms of computation.

More Related